public class MarshalRegistry extends Object
Modifier and Type | Method and Description |
---|---|
static <T> Marshaler<T> |
getMarshaler(TypeReference<T> typeToken,
int nativeType)
Lookup a marshaler between
T and nativeType . |
static <T> void |
registerMarshalQueryable(MarshalQueryable<T> queryable)
Register a marshal queryable for the managed type
T . |
public static <T> void registerMarshalQueryable(MarshalQueryable<T> queryable)
T
.
Multiple marshal queryables for the same managed type T
may be registered;
this is desirable if they support different native types (e.g. marshaler 1 supports
Integer <-> TYPE_INT32
, marshaler 2 supports Integer <-> TYPE_BYTE
.
queryable
- a non-null
marshal queryable that supports marshaling T
public static <T> Marshaler<T> getMarshaler(TypeReference<T> typeToken, int nativeType)
T
and nativeType
.
Marshalers are looked up in the order they were registered; earlier registered marshal queriers get priority.
typeToken
- The compile-time type reference for T
nativeType
- The native type, e.g. TYPE_BYTE
null
marshaler that supports marshaling the type comboUnsupportedOperationException
- If no marshaler matching the args could be found