public final class RuntimeSchema<T> extends MappedSchema<T>
MappedSchema.Field<T>| Modifier and Type | Field and Description |
|---|---|
RuntimeEnv.Instantiator<T> |
instantiator |
fields, fieldsByName, fieldsByNumber, pipeSchema, typeClass| Constructor and Description |
|---|
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) |
| Modifier and Type | Method and Description |
|---|---|
static <T> RuntimeSchema<T> |
createFrom(java.lang.Class<T> typeClass)
Generates a schema from the given class.
|
static <T> RuntimeSchema<T> |
createFrom(java.lang.Class<T> typeClass,
IdStrategy strategy)
Generates a schema from the given class.
|
static <T> RuntimeSchema<T> |
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 <T> RuntimeSchema<T> |
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 <T> RuntimeSchema<T> |
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 <T> Schema<T> |
getSchema(java.lang.Class<T> typeClass)
Gets the schema that was either registered or lazily initialized at runtime.
|
static <T> Schema<T> |
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 <T> boolean |
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 <T> boolean |
register(java.lang.Class<T> typeClass)
Returns true if this there is no existing one or the same schema
has already been registered (this must be done on application startup).
|
static <T> boolean |
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).
|
getFieldCount, getFieldName, getFieldNumber, getPipeSchema, mergeFrom, messageFullName, messageName, typeClass, writeTopublic final RuntimeEnv.Instantiator<T> instantiator
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)
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)
RuntimeEnv.ID_STRATEGY is
DefaultIdStrategy.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()
Copyright © 2009-2023. All Rights Reserved.