Package com.google.gwt.rpc.client.ast

Examples of com.google.gwt.rpc.client.ast.EnumValueCommand


      identityMap.put(value, array);
      extractData(array, value);
      toReturn = array;

    } else if (value instanceof Enum) {
      EnumValueCommand e = new EnumValueCommand();
      e.setValue((Enum<?>) value);
      toReturn = e;

    } else if ((customSerializer = serializer.getOverride(type.getName())) != null) {
      toReturn = invokeCustomSerializer(customSerializer, type, value);
View Full Code Here


    identityMap.put(value, toReturn);
    return toReturn;
  }

  private ValueCommand makeEnum(Object value) {
    EnumValueCommand toReturn = new EnumValueCommand();
    toReturn.setValue((Enum<?>) value);
    return toReturn;
  }
View Full Code Here

      identityMap.put(value, array);
      extractData(array, value);
      toReturn = array;

    } else if (value instanceof Enum) {
      EnumValueCommand e = new EnumValueCommand();
      e.setValue((Enum<?>) value);
      toReturn = e;

    } else if ((customSerializer = serializer.getOverride(type.getName())) != null) {
      toReturn = invokeCustomSerializer(customSerializer, type, value);
View Full Code Here

        push(new StringValueCommand(value));
        break;
      }
      case ENUM_TYPE: {
        // ETypeSeedName~IOrdinal~
        EnumValueCommand x = new EnumValueCommand();
        push(x);
       
        // use ordinal (and not name), since name might have been obfuscated
        int ordinal = readCommand(IntValueCommand.class).getValue();

        @SuppressWarnings("unchecked")
        Class<? extends Enum> clazz = findClass(token).asSubclass(Enum.class);
       
        /*
         * TODO: Note this approach could be prone to subtle corruption or
         * an ArrayOutOfBoundsException if the client and server have drifted.
         */
        Enum<?> enumConstants[] = clazz.getEnumConstants();
        x.setValue(enumConstants[ordinal]);
        break;
      }
      case ARRAY_TYPE: {
        // Encoded as (leafType, dimensions, length, .... )
        Class<?> leaf = findClass(token);

        Integer numDims = readCommand(IntValueCommand.class).getValue();
        Class<?> clazz;
        if (numDims > 1) {
          int[] dims = new int[numDims - 1];
          clazz = Array.newInstance(leaf, dims).getClass();
        } else {
          clazz = leaf;
        }

        ArrayValueCommand x = new ArrayValueCommand(clazz);
        push(x);
        int length = readCommand(IntValueCommand.class).getValue();
        for (int i = 0; i < length; i++) {
          x.add(readCommand(ValueCommand.class));
        }
        break;
      }
      case OBJECT_TYPE: {
        // @TypeSeedName~3~... N-many setters ...
View Full Code Here

        push(new StringValueCommand(value));
        break;
      }
      case ENUM_TYPE: {
        // ETypeSeedName~"9~FieldName
        EnumValueCommand x = new EnumValueCommand();
        push(x);
        String name = readCommand(StringValueCommand.class).getValue();

        @SuppressWarnings("unchecked")
        Class<? extends Enum> clazz = findClass(token).asSubclass(Enum.class);
        @SuppressWarnings("unchecked")
        Enum<?> enumValue = Enum.valueOf(clazz, name);
        x.setValue(enumValue);
        break;
      }
      case ARRAY_TYPE: {
        // Encoded as (leafType, dimensions, length, .... )
        Class<?> leaf = findClass(token);

        Integer numDims = readCommand(IntValueCommand.class).getValue();
        Class<?> clazz;
        if (numDims > 1) {
          int[] dims = new int[numDims - 1];
          clazz = Array.newInstance(leaf, dims).getClass();
        } else {
          clazz = leaf;
        }

        ArrayValueCommand x = new ArrayValueCommand(clazz);
        push(x);
        int length = readCommand(IntValueCommand.class).getValue();
        for (int i = 0; i < length; i++) {
          x.add(readCommand(ValueCommand.class));
        }
        break;
      }
      case OBJECT_TYPE: {
        // @TypeSeedName~3~... N-many setters ...
View Full Code Here

      identityMap.put(value, array);
      extractData(array, value);
      toReturn = array;

    } else if (value instanceof Enum<?>) {
      EnumValueCommand e = new EnumValueCommand();
      e.setValue((Enum<?>) value);
      toReturn = e;

    } else if ((customSerializer = serializer.getOverride(type.getName())) != null) {
      toReturn = invokeCustomSerializer(customSerializer, type, value);
View Full Code Here

TOP

Related Classes of com.google.gwt.rpc.client.ast.EnumValueCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.