|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.dyuproject.protostuff.runtime.MappedSchema<T>
com.dyuproject.protostuff.runtime.RuntimeSchema<T>
public final class RuntimeSchema<T>
A schema that can be generated and cached at runtime for objects that have no schema. This is particularly useful for pojos from 3rd party libraries.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.dyuproject.protostuff.runtime.MappedSchema |
|---|
MappedSchema.Field<T> |
| Field Summary | |
|---|---|
RuntimeEnv.Instantiator<T> |
instantiator
|
| Fields inherited from class com.dyuproject.protostuff.runtime.MappedSchema |
|---|
fields, fieldsByName, fieldsByNumber, pipeSchema, typeClass |
| Constructor Summary | |
|---|---|
RuntimeSchema(java.lang.Class<T> typeClass,
java.util.Collection<MappedSchema.Field<T>> fields,
int lastFieldNumber,
java.lang.reflect.Constructor<T> constructor)
|
|
RuntimeSchema(java.lang.Class<T> typeClass,
java.util.Collection<MappedSchema.Field<T>> fields,
int lastFieldNumber,
RuntimeEnv.Instantiator<T> instantiator)
|
|
| Method Summary | ||
|---|---|---|
static
|
createFrom(java.lang.Class<T> typeClass)
Generates a schema from the given class. |
|
static
|
createFrom(java.lang.Class<T> typeClass,
IdStrategy strategy)
Generates a schema from the given class. |
|
static
|
createFrom(java.lang.Class<T> typeClass,
java.util.Map<java.lang.String,java.lang.String> declaredFields,
IdStrategy strategy)
Generates a schema from the given class with the declared fields (inclusive) based from the given Map. |
|
static
|
createFrom(java.lang.Class<T> typeClass,
java.util.Set<java.lang.String> exclusions,
IdStrategy strategy)
Generates a schema from the given class with the exclusion of certain fields. |
|
static
|
createFrom(java.lang.Class<T> typeClass,
java.lang.String[] exclusions,
IdStrategy strategy)
Generates a schema from the given class with the exclusion of certain fields. |
|
static
|
getSchema(java.lang.Class<T> typeClass)
Gets the schema that was either registered or lazily initialized at runtime. |
|
static
|
getSchema(java.lang.Class<T> typeClass,
IdStrategy strategy)
Gets the schema that was either registered or lazily initialized at runtime. |
|
boolean |
isInitialized(T message)
Always returns true, everything is optional. |
|
static boolean |
isRegistered(java.lang.Class<?> typeClass)
Returns true if the typeClass was not lazily created. |
|
static boolean |
isRegistered(java.lang.Class<?> typeClass,
IdStrategy strategy)
Returns true if the typeClass was not lazily created. |
|
static
|
map(java.lang.Class<? super T> baseClass,
java.lang.Class<T> typeClass)
Maps the baseClass to a specific non-interface/non-abstract
typeClass and registers it (this must be done on application startup). |
|
T |
newMessage()
|
|
static
|
register(java.lang.Class<T> typeClass,
Schema<T> schema)
Returns true if this there is no existing one or the same schema has already been registered (this must be done on application startup). |
|
| Methods inherited from class com.dyuproject.protostuff.runtime.MappedSchema |
|---|
getFieldCount, getFieldName, getFieldNumber, getPipeSchema, mergeFrom, messageFullName, messageName, typeClass, writeTo |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final RuntimeEnv.Instantiator<T> instantiator
| Constructor Detail |
|---|
public RuntimeSchema(java.lang.Class<T> typeClass,
java.util.Collection<MappedSchema.Field<T>> fields,
int lastFieldNumber,
java.lang.reflect.Constructor<T> constructor)
public RuntimeSchema(java.lang.Class<T> typeClass,
java.util.Collection<MappedSchema.Field<T>> fields,
int lastFieldNumber,
RuntimeEnv.Instantiator<T> instantiator)
| Method Detail |
|---|
public static <T> boolean map(java.lang.Class<? super T> baseClass,
java.lang.Class<T> typeClass)
baseClass to a specific non-interface/non-abstract
typeClass and registers it (this must be done on application startup).
With this approach, there is no overhead of writing the type metadata if a
baseClass field is serialized.
Returns true if the baseClass does not exist.
NOTE: This is only supported when RuntimeEnv.ID_STRATEGY is
DefaultIdStrategy.
java.lang.IllegalArgumentException - if the typeClass is an interface or
an abstract class.
public static <T> boolean register(java.lang.Class<T> typeClass,
Schema<T> schema)
RuntimeEnv.ID_STRATEGY is
DefaultIdStrategy.
public static boolean isRegistered(java.lang.Class<?> typeClass)
typeClass was not lazily created.
Method overload for backwards compatibility.
public static boolean isRegistered(java.lang.Class<?> typeClass,
IdStrategy strategy)
typeClass was not lazily created.
public static <T> Schema<T> getSchema(java.lang.Class<T> typeClass)
public static <T> Schema<T> getSchema(java.lang.Class<T> typeClass,
IdStrategy strategy)
public static <T> RuntimeSchema<T> createFrom(java.lang.Class<T> typeClass)
public static <T> RuntimeSchema<T> createFrom(java.lang.Class<T> typeClass,
IdStrategy strategy)
public static <T> RuntimeSchema<T> createFrom(java.lang.Class<T> typeClass,
java.lang.String[] exclusions,
IdStrategy strategy)
public static <T> RuntimeSchema<T> createFrom(java.lang.Class<T> typeClass,
java.util.Set<java.lang.String> exclusions,
IdStrategy strategy)
public static <T> RuntimeSchema<T> createFrom(java.lang.Class<T> typeClass,
java.util.Map<java.lang.String,java.lang.String> declaredFields,
IdStrategy strategy)
public boolean isInitialized(T message)
public T newMessage()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||