java.lang.Object | |
↳ | com.google.gwt.user.rebind.rpc.SerializableTypeOracleBuilder |
Builds a SerializableTypeOracle
for a given set of root types.
There are two goals for this builder. First, discover the set of serializable types that can be serialized if you serialize one of the root types. Second, to make sure that all root types can actually be serialized by GWT.
To find the serializable types, it includes the root types, and then it iteratively traverses the type hierarchy and the fields of any type already deemed serializable. To improve the accuracy of the traversal there is a computations of the exposure of type parameters. When the traversal reaches a parameterized type, these exposure values are used to determine how to treat the arguments.
A type qualifies for serialization if it or one of its subtypes is
automatically or manually serializable. Automatic serialization is selected
if the type is assignable to IsSerializable
or Serializable
or if the type is a primitive type such as int, boolean, etc. Manual
serialization is selected if there exists another type with the same fully
qualified name concatenated with "_CustomFieldSerializer". If a type
qualifies for both manual and automatic serialization, manual serialization
is preferred.
Some types may be marked as "enhanced," either automatically by the presence
of a JDO @PersistenceCapable
or JPA @Entity
tag on
the class definition, or manually by extending the 'rpc.enhancedClasses'
configuration property in the GWT module XML file. For example, to manually
mark the class com.google.myapp.MyPersistentClass as enhanced, use:
Enhanced classes are checked for the presence of additional serializable fields on the server that were not defined in client code as seen by the GWT compiler. If it is possible for an instance of such a class to be transmitted bidrectionally between server and client, a special RPC rule is used. The server-only fields are serialized using standard Java serialization and sent between the client and server as a blob of opaque base-64 encoded binary data. When an instance is sent from client to server, the server instance is populated by invoking setter methods where possible rather than by setting fields directly. This allows APIs such as JDO the opportunity to update the object state properly to take into account changes that may have occurred to the object's state while resident on the client.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a builder.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Builds a
SerializableTypeOracle for a given set of root types. | |||||||||||
Finds the custom field serializer for a given type.
| |||||||||||
Set the
PrintWriter which will receive a detailed log of the types
which were examined in order to determine serializability. | |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Constructs a builder.
UnableToCompleteException | if we fail to find one of our special types |
---|
Builds a SerializableTypeOracle
for a given set of root types.
SerializableTypeOracle
for the specified set of root
typesUnableToCompleteException | if there was not at least one instantiable type assignable to each of the specified root types |
---|
Finds the custom field serializer for a given type.
null
if
there is not one
Set the PrintWriter
which will receive a detailed log of the types
which were examined in order to determine serializability.