Modifier and Type | Class and Description |
---|---|
class |
ObjectMapper.BoundInstance
Represents an object mapper bound to a certain instance of the object
|
protected static class |
ObjectMapper.FieldData
Holder for field-specific information
|
Modifier | Constructor and Description |
---|---|
protected |
ObjectMapper(Class<T> clazz)
Create a new object mapper of a given type
|
Modifier and Type | Method and Description |
---|---|
ObjectMapper.BoundInstance |
bind(T instance)
Return a view on this mapper that is bound to a single object instance
|
ObjectMapper.BoundInstance |
bindToNew()
Returns a view on this mapper that is bound to a newly created object instance
|
boolean |
canCreateInstances()
Returns whether this object mapper can create new object instances.
|
protected void |
collectFields(Map<String,ObjectMapper.FieldData> cachedFields,
Class<? super T> clazz) |
protected T |
constructObject()
Create a new instance of an object of the appropriate type.
|
static <T> ObjectMapper<T> |
forClass(Class<T> clazz)
Create a new object mapper that can work with objects of the given class
|
static <T> ObjectMapper.BoundInstance |
forObject(T obj) |
Class<T> |
getMappedType() |
protected ObjectMapper(Class<T> clazz) throws ObjectMappingException
clazz
- The type this object mapper will work withObjectMappingException
- if the provided class is in someway invalidpublic static <T> ObjectMapper<T> forClass(Class<T> clazz) throws ObjectMappingException
T
- The typeclazz
- The type of objectObjectMappingException
- If invalid annotated fields are presentedpublic static <T> ObjectMapper.BoundInstance forObject(T obj) throws ObjectMappingException
ObjectMappingException
protected void collectFields(Map<String,ObjectMapper.FieldData> cachedFields, Class<? super T> clazz) throws ObjectMappingException
ObjectMappingException
protected T constructObject() throws ObjectMappingException
ObjectMappingException
- If constructing a new instance was not possiblepublic boolean canCreateInstances()
public ObjectMapper.BoundInstance bind(T instance)
instance
- The instance to bind topublic ObjectMapper.BoundInstance bindToNew() throws ObjectMappingException
ObjectMappingException
- If the object could not be constructed correctlybind(Object)
Copyright © 2014–2017. All rights reserved.