|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.gwt.user.rebind.rpc.SerializableTypeOracleBuilder
public class 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.
| Constructor Summary | |
|---|---|
SerializableTypeOracleBuilder(TreeLogger logger,
PropertyOracle propertyOracle,
TypeOracle typeOracle)
Constructs a builder. |
|
| Method Summary | |
|---|---|
void |
addRootType(TreeLogger logger,
JType type)
|
SerializableTypeOracle |
build(TreeLogger logger)
Builds a SerializableTypeOracle for a given set of root types. |
static JClassType |
findCustomFieldSerializer(TypeOracle typeOracle,
JType type)
Finds the custom field serializer for a given type. |
void |
setLogOutputWriter(java.io.PrintWriter logOutputWriter)
Set the PrintWriter which will receive a detailed log of the types
which were examined in order to determine serializability. |
void |
setTypeFilter(com.google.gwt.user.rebind.rpc.TypeFilter typeFilter)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SerializableTypeOracleBuilder(TreeLogger logger,
PropertyOracle propertyOracle,
TypeOracle typeOracle)
throws UnableToCompleteException
logger - propertyOracle - typeOracle -
UnableToCompleteException - if we fail to find one of our special
types| Method Detail |
|---|
public static JClassType findCustomFieldSerializer(TypeOracle typeOracle,
JType type)
typeOracle - type -
null if
there is not one
public void addRootType(TreeLogger logger,
JType type)
public SerializableTypeOracle build(TreeLogger logger)
throws UnableToCompleteException
SerializableTypeOracle for a given set of root types.
logger -
SerializableTypeOracle for the specified set of root
types
UnableToCompleteException - if there was not at least one
instantiable type assignable to each of the specified root typespublic void setLogOutputWriter(java.io.PrintWriter logOutputWriter)
PrintWriter which will receive a detailed log of the types
which were examined in order to determine serializability.
public void setTypeFilter(com.google.gwt.user.rebind.rpc.TypeFilter typeFilter)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||