| Modifier and Type | Field and Description |
|---|---|
static String |
ERROR_TAG_VALUE |
RuntimeEnv.Instantiator<T> |
instantiator |
static int |
MAX_TAG_VALUE |
static int |
MIN_TAG_FOR_HASH_FIELD_MAP |
static int |
MIN_TAG_VALUE |
| Constructor and Description |
|---|
RuntimeSchema(Class<T> typeClass,
Collection<Field<T>> fields,
Constructor<T> constructor) |
RuntimeSchema(Class<T> typeClass,
Collection<Field<T>> fields,
RuntimeEnv.Instantiator<T> instantiator) |
| Modifier and Type | Method and Description |
|---|---|
static <T> RuntimeSchema<T> |
createFrom(Class<T> typeClass)
Generates a schema from the given class.
|
static <T> RuntimeSchema<T> |
createFrom(Class<T> typeClass,
IdStrategy strategy)
Generates a schema from the given class.
|
static <T> RuntimeSchema<T> |
createFrom(Class<T> typeClass,
Map<String,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(Class<T> typeClass,
Set<String> exclusions,
IdStrategy strategy)
Generates a schema from the given class with the exclusion of certain fields.
|
static <T> RuntimeSchema<T> |
createFrom(Class<T> typeClass,
String[] exclusions,
IdStrategy strategy)
Generates a schema from the given class with the exclusion of certain fields.
|
Field<T> |
getFieldByName(String fieldName) |
Field<T> |
getFieldByNumber(int n) |
int |
getFieldCount() |
String |
getFieldName(int number) |
int |
getFieldNumber(String name) |
List<Field<T>> |
getFields() |
Pipe.Schema<T> |
getPipeSchema()
Returns the pipe schema linked to this.
|
static <T> Schema<T> |
getSchema(Class<T> typeClass)
Gets the schema that was either registered or lazily initialized at runtime.
|
static <T> Schema<T> |
getSchema(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(Class<?> typeClass)
Returns true if the
typeClass was not lazily created. |
static boolean |
isRegistered(Class<?> typeClass,
IdStrategy strategy)
Returns true if the
typeClass was not lazily created. |
static <T> boolean |
map(Class<? super T> baseClass,
Class<T> typeClass)
Maps the
baseClass to a specific non-interface/non-abstract typeClass and registers it (this must
be done on application startup). |
void |
mergeFrom(Input input,
T message) |
String |
messageFullName() |
String |
messageName() |
T |
newMessage() |
static <T> boolean |
register(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(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).
|
Class<T> |
typeClass() |
void |
writeTo(Output output,
T message) |
public static final int MIN_TAG_VALUE
public static final int MAX_TAG_VALUE
public static final String ERROR_TAG_VALUE
public static final int MIN_TAG_FOR_HASH_FIELD_MAP
public final RuntimeEnv.Instantiator<T> instantiator
public RuntimeSchema(Class<T> typeClass, Collection<Field<T>> fields, Constructor<T> constructor)
public RuntimeSchema(Class<T> typeClass, Collection<Field<T>> fields, RuntimeEnv.Instantiator<T> instantiator)
public static <T> boolean map(Class<? super T> baseClass, 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.
IllegalArgumentException - if the typeClass is an interface or an abstract class.public static <T> boolean register(Class<T> typeClass, Schema<T> schema)
NOTE: This is only supported when RuntimeEnv.ID_STRATEGY is DefaultIdStrategy.
public static <T> boolean register(Class<T> typeClass)
NOTE: This is only supported when RuntimeEnv.ID_STRATEGY is DefaultIdStrategy.
public static boolean isRegistered(Class<?> typeClass)
typeClass was not lazily created.
Method overload for backwards compatibility.
public static boolean isRegistered(Class<?> typeClass, IdStrategy strategy)
typeClass was not lazily created.public static <T> Schema<T> getSchema(Class<T> typeClass)
Method overload for backwards compatibility.
public static <T> Schema<T> getSchema(Class<T> typeClass, IdStrategy strategy)
public static <T> RuntimeSchema<T> createFrom(Class<T> typeClass)
Method overload for backwards compatibility.
public static <T> RuntimeSchema<T> createFrom(Class<T> typeClass, IdStrategy strategy)
public static <T> RuntimeSchema<T> createFrom(Class<T> typeClass, String[] exclusions, IdStrategy strategy)
public static <T> RuntimeSchema<T> createFrom(Class<T> typeClass, Set<String> exclusions, IdStrategy strategy)
public static <T> RuntimeSchema<T> createFrom(Class<T> typeClass, Map<String,String> declaredFields, IdStrategy strategy)
public Pipe.Schema<T> getPipeSchema()
public int getFieldCount()
public String messageName()
messageName in interface Schema<T>public String messageFullName()
messageFullName in interface Schema<T>public String getFieldName(int number)
getFieldName in interface Schema<T>public int getFieldNumber(String name)
getFieldNumber in interface Schema<T>public final void mergeFrom(Input input, T message) throws IOException
mergeFrom in interface Schema<T>IOExceptionpublic final void writeTo(Output output, T message) throws IOException
writeTo in interface Schema<T>IOExceptionpublic boolean isInitialized(T message)
isInitialized in interface Schema<T>public T newMessage()
newMessage in interface Schema<T>Copyright © 2009–2020. All rights reserved.