com.google.gwt.user.rebind.rpc
Class SerializableTypeOracleBuilder
java.lang.Object
com.google.gwt.user.rebind.rpc.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:
- It is a primitive type
- It is java.lang.String
- It is an array type whose component type is also serializable
- Has a custom field serializer
- Implements or inherits IsSerializable and all fields are of serializable
types
- 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)
- Is default constructable (arrays are an exception since arrays cannot be
default constructed since the length must be specified)
Reachable Types Algorithm:
- Start with the service interface
- For every type, paramter, return and throws, listed in the method
signature, add it.
- 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:
- Set done to true;
- For every serializable type, perform the following checks:
- Has a custom serializer then skip it
- 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.
- 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.
- 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.
- If done == false go back to step 1.
SerializableTypeOracleBuilder
public SerializableTypeOracleBuilder(TreeLogger rootLogger,
TypeOracle typeOracle)
throws NotFoundException
build
public SerializableTypeOracle build(JType[] types)
throws NotFoundException
- Build a
SerializationOracle from the TypeOracle and
RemoteService interface.
- Throws:
NotFoundException
This javadoc distribution was not produced by Google. The official documentation is here.