Class SerializableTypeOracleBuilder


public class SerializableTypeOracleBuilder
extends Object

This class is responsible for building an oracle can answer questions about the set of serializable types that are reachable from an interface that extends the RemoteService interface.

A type is serializable if:

  1. It is a primitive type
  2. It is java.lang.String
  3. It is an array type whose component type is also serializable
  4. Has a custom field serializer
  5. Implements or inherits IsSerializable and all fields are of serializable types
  6. Has at least one serializable concrete subtype (This type not strictly serializable but it does not prevent a containing type from being serializable nor does it prevent a service interface from being valid)
  7. Is default constructable (arrays are an exception since arrays cannot be default constructed since the length must be specified)

Reachable Types Algorithm:

  1. Start with the service interface
  2. For every type, paramter, return and throws, listed in the method signature, add it.
  3. For every type added, if the type inherits IsSerializable or it has a custom field serializer mark it as serializable. Then, recusively add all of its subtypes and the types of every field that is not static, final, or transient.

Serializability Algorithm:

  1. Set done to true;
  2. For every serializable type, perform the following checks:
    1. Has a custom serializer then skip it
    2. Inherits IsSerializable, check if superclass is still serializable. If not, then set serializable to false, and set done to false. If it is, then proceed as in c.
    3. Implements IsSerializable, check all fields to make sure that all of the field types are serializable. If a field type is not serializable but it does have a serializable subtype then continue. Otherwise, mark the type as not being serializable set done to false.
    4. If the type does not implement or inherit IsSerializable and it does not have a custom serializer, then mark it as not being serializableand set done equal to false.
  3. If done == false go back to step 1.

Field Summary
Fields inherited from class java.lang.Object
typeId, typeName
Constructor Summary
SerializableTypeOracleBuilder(TreeLogger rootLogger, TypeOracle typeOracle)
Method Summary
 SerializableTypeOracle build(JType[] types)
          Build a SerializationOracle from the TypeOracle and RemoteService interface.
Methods inherited from class java.lang.Object
equals, finalize, hashCode, toString

Constructor Detail


public SerializableTypeOracleBuilder(TreeLogger rootLogger,
                                     TypeOracle typeOracle)
                              throws NotFoundException
Method Detail


public SerializableTypeOracle build(JType[] types)
                             throws NotFoundException
Build a SerializationOracle from the TypeOracle and RemoteService interface.


This javadoc distribution was not produced by Google. The official documentation is here.