Interface ObjectMapper.Factory
-
- Enclosing interface:
- ObjectMapper<V>
public static interface ObjectMapper.Factory
Provider for object mappers.- Since:
- 4.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ObjectMapper.Factory.Builder
A builder for a configured factory producing object mappers.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description TypeSerializer<Object>
asTypeSerializer()
Creates aTypeSerializer
that uses this factory.default <V> ObjectMapper<V>
get(TypeToken<V> type)
Get an object mapper for the provided type.default <V> ObjectMapper<V>
get(Class<V> clazz)
Get an object mapper for the unparameterized typeclazz
.ObjectMapper<?>
get(Type type)
Get the object mapper for the provided type.
-
-
-
Method Detail
-
get
default <V> ObjectMapper<V> get(TypeToken<V> type) throws SerializationException
Get an object mapper for the provided type.The provided type cannot be a raw type.
- Type Parameters:
V
- mapped type- Parameters:
type
- token holding the mapped type- Returns:
- a mapper for the provided type
- Throws:
SerializationException
- if the type does not correspond to a mappable object- Since:
- 4.0.0
-
get
default <V> ObjectMapper<V> get(Class<V> clazz) throws SerializationException
Get an object mapper for the unparameterized typeclazz
.The provided type cannot be a raw type.
- Type Parameters:
V
- mapped type- Parameters:
clazz
- class of the mapped type- Returns:
- a mapper for the provided type
- Throws:
SerializationException
- if the type does not correspond to a mappable object- Since:
- 4.0.0
-
get
ObjectMapper<?> get(Type type) throws SerializationException
Get the object mapper for the provided type.The provided type cannot be a raw type.
- Parameters:
type
- object type.- Returns:
- a mapper for the provided type
- Throws:
SerializationException
- if the type does not correspond to a mappable object- Since:
- 4.0.0
-
asTypeSerializer
TypeSerializer<Object> asTypeSerializer()
Creates aTypeSerializer
that uses this factory.The serializer will accept any object type that could otherwise be handled by this factory. To match a standard configuration, register this serializer with
TypeSerializerCollection.Builder.registerAnnotatedObjects(Factory)
to enforce the presence ofConfigSerializable
annotations.- Returns:
- a type serializer
- Since:
- 4.0.0
-
-