KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > google > gwt > user > rebind > rpc > SerializableTypeOracle


1 /*
2  * Copyright 2007 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */

16 package com.google.gwt.user.rebind.rpc;
17
18 import com.google.gwt.core.ext.typeinfo.JClassType;
19 import com.google.gwt.core.ext.typeinfo.JField;
20 import com.google.gwt.core.ext.typeinfo.JType;
21
22 /**
23  * Interface implemented by any class that wants to answer questions about
24  * serializable types for a given
25  * {@link com.google.gwt.user.client.rpc.RemoteService RemoteService}.
26  */

27 public interface SerializableTypeOracle {
28   /**
29    * Returns the name of the field serializer for a particular type. This name
30    * can be either the name of a custom field serializer or that of a generated
31    * field serializer. If the type is not serializable then it can return null.
32    *
33    * @param type the type that is going to be serialized
34    * @return the fully qualified name of the field serializer for the given type
35    */

36   String JavaDoc getFieldSerializerName(JType type);
37
38   /**
39    * Returns the set of fields that are serializable for a given class type.
40    * This method does not consider any superclass fields.
41    *
42    * @param classType the class for which we want serializable fields
43    * @return array of fields that meet the serialization criteria.
44    */

45   JField[] getSerializableFields(JClassType classType);
46
47   /**
48    * Returns the list of all types that are considered serializable.
49    *
50    * @return array of serializable types
51    */

52   JType[] getSerializableTypes();
53
54   /**
55    * Returns the serialization signature for a type.
56    *
57    * @param instanceType
58    * @return a string representing the serialization signature of a type
59    */

60   String JavaDoc getSerializationSignature(JType instanceType);
61
62   /**
63    * Returns the serialized name of a type. The serialized name of a type is
64    * the name that would be returned by {@link Class#getName()}.
65    *
66    * @param type
67    * @return serialized name of a type
68    */

69   String JavaDoc getSerializedTypeName(JType type);
70
71   /**
72    * Returns the qualified name of the type serializer class for the given
73    * service interface.
74    *
75    * @param serviceIntf service interface
76    * @return name of the type serializer that handles the service interface
77    */

78   String JavaDoc getTypeSerializerQualifiedName(JClassType serviceIntf);
79
80   /**
81    * Returns the simple name of the type serializer class for the given service
82    * interface.
83    *
84    * @param serviceIntf service interface
85    * @return the simple name of the type serializer class
86    */

87   String JavaDoc getTypeSerializerSimpleName(JClassType serviceIntf);
88
89   /**
90    * Returns the custom field serializer associated with the given type. If
91    * there is none, null is returned.
92    *
93    * @param type type that may have a custom field serializer
94    * @return custom field serializer or null if there is none
95    */

96   JClassType hasCustomFieldSerializer(JType type);
97
98   /**
99    * Returns true if the type is serializable. If a type is serializable then
100    * there is a secondary type called a FieldSerializer that provides the
101    * behavior necessary to serialize or deserialize the fields of an instance.
102    *
103    * @param type the type that maybe serializable
104    * @return true if the type is serializable
105    */

106   boolean isSerializable(JType type);
107 }
108
Popular Tags