Examples of ValueCommand


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

   * Type is passed in to handle primitive types.
   */
  protected ValueCommand makeValue(Class<?> type, Object value)
      throws SerializationException {
    SerializeFunction customSerializer;
    ValueCommand toReturn;

    if (value == null) {
      toReturn = NullValueCommand.INSTANCE;
    } else if (type.isPrimitive()) {
      if (type == boolean.class) {
View Full Code Here

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

      Field[] serializableFields = clientOracle.getOperableFields(type);
      for (Field declField : serializableFields) {
        assert (declField != null);

        Accessor accessor = CommandSerializationUtil.getAccessor(declField.getType());
        ValueCommand valueCommand;
        Object fieldValue = accessor.get(value, declField);
        if (fieldValue == null) {
          valueCommand = NullValueCommand.INSTANCE;
        } else {
          Class<? extends Object> fieldType = declField.getType().isPrimitive()
View Full Code Here

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

  public long readLong() throws SerializationException {
    return readNumberCommand(LongValueCommand.class).getValue();
  }

  public Object readObject() throws SerializationException {
    ValueCommand command = readNextCommand(ValueCommand.class);
    Visitor v = new Visitor();
    v.accept(command);
    return v.values.pop();
  }
View Full Code Here

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

  private <T extends ValueCommand> T readNextCommand(Class<T> clazz)
      throws SerializationException {
    if (!values.hasNext()) {
      throw new SerializationException("Reached end of stream");
    }
    ValueCommand next = values.next();
    if (!clazz.isInstance(next)) {
      throw new SerializationException("Cannot assign "
          + next.getClass().getName() + " to " + clazz.getName());
    }
    return clazz.cast(next);
  }
View Full Code Here

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

  private <T extends ValueCommand> T readNumberCommand(Class<T> clazz)
      throws SerializationException {
    if (!values.hasNext()) {
      throw new SerializationException("Reached end of stream");
    }
    ValueCommand next = values.next();

    if (clazz.isInstance(next)) {
      return clazz.cast(next);
    } else if (next instanceof LongValueCommand) {
      if (!clazz.isInstance(next)) {
        throw new SerializationException("Cannot assign "
            + next.getClass().getName() + " to " + clazz.getName());
      }
      return clazz.cast(next);
    } else if (next instanceof DoubleValueCommand) {
      Exception ex;
      try {
        Constructor<T> c = clazz.getConstructor(double.class);
        return c.newInstance(((DoubleValueCommand) next).getValue().doubleValue());
      } catch (SecurityException e) {
        throw new SerializationException("Cannot construct ValueCommand type",
            e);
      } catch (NoSuchMethodException e) {
        throw new SerializationException("Connot initialize a "
            + clazz.getName() + " from a DoubleValueCommand", e);
      } catch (IllegalArgumentException e) {
        ex = e;
      } catch (InstantiationException e) {
        ex = e;
      } catch (IllegalAccessException e) {
        ex = e;
      } catch (InvocationTargetException e) {
        ex = e;
      }
      throw new SerializationException("Cannot create ValueCommand", ex);
    } else {
      throw new SerializationException(
          "Cannot create a numeric ValueCommand from a "
              + next.getClass().getName());
    }
  }
View Full Code Here

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

  public long readLong() throws SerializationException {
    return readNumberCommand(LongValueCommand.class).getValue();
  }

  public Object readObject() throws SerializationException {
    ValueCommand command = readNextCommand(ValueCommand.class);
    Visitor v = new Visitor();
    v.accept(command);
    return v.values.pop();
  }
View Full Code Here

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

  private <T extends ValueCommand> T readNextCommand(Class<T> clazz)
      throws SerializationException {
    if (!values.hasNext()) {
      throw new SerializationException("Reached end of stream");
    }
    ValueCommand next = values.next();
    if (!clazz.isInstance(next)) {
      throw new SerializationException("Cannot assign "
          + next.getClass().getName() + " to " + clazz.getName());
    }
    return clazz.cast(next);
  }
View Full Code Here

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

  private <T extends ValueCommand> T readNumberCommand(Class<T> clazz)
      throws SerializationException {
    if (!values.hasNext()) {
      throw new SerializationException("Reached end of stream");
    }
    ValueCommand next = values.next();

    if (clazz.isInstance(next)) {
      return clazz.cast(next);
    } else if (next instanceof LongValueCommand) {
      if (!clazz.isInstance(next)) {
        throw new SerializationException("Cannot assign "
            + next.getClass().getName() + " to " + clazz.getName());
      }
      return clazz.cast(next);
    } else if (next instanceof DoubleValueCommand) {
      Exception ex;
      try {
        Constructor<T> c = clazz.getConstructor(double.class);
        return c.newInstance(((DoubleValueCommand) next).getValue().doubleValue());
      } catch (SecurityException e) {
        throw new SerializationException("Cannot construct ValueCommand type",
            e);
      } catch (NoSuchMethodException e) {
        throw new SerializationException("Connot initialize a "
            + clazz.getName() + " from a DoubleValueCommand", e);
      } catch (IllegalArgumentException e) {
        ex = e;
      } catch (InstantiationException e) {
        ex = e;
      } catch (IllegalAccessException e) {
        ex = e;
      } catch (InvocationTargetException e) {
        ex = e;
      }
      throw new SerializationException("Cannot create ValueCommand", ex);
    } else {
      throw new SerializationException(
          "Cannot create a numeric ValueCommand from a "
              + next.getClass().getName());
    }
  }
View Full Code Here

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

   * Type is passed in to handle primitive types.
   */
  protected ValueCommand makeValue(Class<?> type, Object value)
      throws SerializationException {
    SerializeFunction customSerializer;
    ValueCommand toReturn;

    if (value == null) {
      toReturn = NullValueCommand.INSTANCE;
    } else if (type.isPrimitive()) {
      if (type == boolean.class) {
View Full Code Here

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

        toThrow = readCommand(ValueCommand.class);
        break;
      }
      case BACKREF_TYPE: {
        // @backrefNumber~
        ValueCommand x = backRefs.get(Integer.valueOf(token));
        assert x != null : "Could not find backref";
        commands.push(x);
        break;
      }
      case RPC_SEPARATOR_CHAR: {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.