public class TypeRegistry<U> extends Object implements Serializable
TypeEncoder should be used for decoding a value. Any value for an alias can be
used on a TypeEncoder, with the the limitation that all TypeEncoders added to the TypeRegistry must
be unique.| Constructor and Description |
|---|
TypeRegistry(Iterable<TypeEncoder<?,U>> normalizers) |
TypeRegistry(TypeEncoder<?,U>... normalizers) |
TypeRegistry(TypeRegistry<U> registry,
TypeEncoder<?,U>... normalizers) |
| Modifier and Type | Method and Description |
|---|---|
Object |
decode(String alias,
U value)
Decodes the given
value using one of the registered TypeEncoders. |
U |
encode(Object value)
Encodes the given
value using one of the registered TypeEncoders. |
String |
getAlias(Object obj)
Gets registered alias for a provided object type.
|
Collection<TypeEncoder<?,U>> |
getAllEncoders()
Returns all the registered
TypeEncoders in the registry |
String |
getClassAlias(Class clazz)
Retrieves the registered alias for the provided
Class. |
public TypeRegistry(TypeEncoder<?,U>... normalizers)
public TypeRegistry(TypeRegistry<U> registry, TypeEncoder<?,U>... normalizers)
public TypeRegistry(Iterable<TypeEncoder<?,U>> normalizers)
public String getAlias(Object obj)
TypeEncoder to use for decoding.public String getClassAlias(Class clazz)
Class.public U encode(Object value)
value using one of the registered TypeEncoders.public Object decode(String alias, U value)
value using one of the registered TypeEncoders. The alias is used
to determine which TypeEncoder will be used and shall correlate to the result of the getAlias()
method for the original object.public Collection<TypeEncoder<?,U>> getAllEncoders()
TypeEncoders in the registryCopyright © 2018 Calrissian. All rights reserved.