Java 类com.google.gwt.user.client.rpc.impl.AbstractSerializationStream 实例源码

项目:gwt-syncproxy    文件:ObjectGraphTest.java   
public void testElision() throws SerializationException {
    ObjectGraphTestServiceAsync async = getServiceAsync();

    SerializationStreamWriter writer = ((SerializationStreamFactory) async)
            .createStreamWriter();
    AbstractSerializationStream stream = (AbstractSerializationStream) writer;
    assertEquals(
            "Missing flag",
            expectedObfuscationState(),
            stream.hasFlags(AbstractSerializationStream.FLAG_ELIDE_TYPE_NAMES));

    SerializableDoublyLinkedNode node = new SerializableDoublyLinkedNode();
    writer.writeObject(node);
    String s = writer.toString();

    // Don't use class.getName() due to conflict with removal of type names
    assertEquals("Checking for SerializableDoublyLinkedNode",
            expectedObfuscationState(),
            !s.contains("SerializableDoublyLinkedNode"));
}
项目:gwt-syncproxy    文件:ObjectGraphTest.java   
public void testElision() throws SerializationException {
    ObjectGraphTestServiceAsync async = getServiceAsync();

    SerializationStreamWriter writer = ((SerializationStreamFactory) async)
            .createStreamWriter();
    AbstractSerializationStream stream = (AbstractSerializationStream) writer;
    assertEquals(
            "Missing flag",
            expectedObfuscationState(),
            stream.hasFlags(AbstractSerializationStream.FLAG_ELIDE_TYPE_NAMES));

    SerializableDoublyLinkedNode node = new SerializableDoublyLinkedNode();
    writer.writeObject(node);
    String s = writer.toString();

    // Don't use class.getName() due to conflict with removal of type names
    assertEquals("Checking for SerializableDoublyLinkedNode",
            expectedObfuscationState(),
            !s.contains("SerializableDoublyLinkedNode"));
}
项目:gwt-storage    文件:ServerStorageSerializer.java   
public <T> String serialize(Class<? super T> clazz, T instance, SerializationPolicy serializationPolicy) throws SerializationException {
  if (instance == null) {
    return null;
  }else if(String.class.equals(clazz)){
    return (String) instance;
  }

  if (serializationPolicy == null) {
    throw new IllegalArgumentException("SerializationPolicy is null, please call StorageUtils.PolicyLoader.load(...) before");
  }

  ServerSerializationStreamWriter stream = new ServerSerializationStreamWriter(serializationPolicy);
  stream.setFlags(AbstractSerializationStream.DEFAULT_FLAGS);
  stream.prepareToWrite();
  if (clazz != void.class) {
    stream.serializeValue(instance, clazz);
  }
  return stream.toString();
}
项目:kaa    文件:RpcHelper.java   
public static String invokeAndEncodeResponse(Object target,
                                             Method serviceMethod,
                                             Object[] args,
                                             SerializationPolicy serializationPolicy)
    throws SerializationException {
  return invokeAndEncodeResponse(target, serviceMethod, args, serializationPolicy,
      AbstractSerializationStream.DEFAULT_FLAGS);
}
项目:sandbox-frame    文件:RPCHelper.java   
public static String invokeAndEncodeResponse(Object target, Method serviceMethod, Object[] args,
    SerializationPolicy serializationPolicy) throws SerializationException {
  return invokeAndEncodeResponse(target, serviceMethod, args, serializationPolicy,
      AbstractSerializationStream.DEFAULT_FLAGS);
}
项目:avro-ui    文件:RPCHelper.java   
public static String invokeAndEncodeResponse(Object target, Method serviceMethod, Object[] args,
    SerializationPolicy serializationPolicy) throws SerializationException {
  return invokeAndEncodeResponse(target, serviceMethod, args, serializationPolicy,
      AbstractSerializationStream.DEFAULT_FLAGS);
}