public class Mapper extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Mapper.FieldToEntryConverter
Converts a field access set into a collection of map entries.
|
Constructor and Description |
---|
Mapper() |
Mapper(boolean acceptSingleValueAsArray) |
Mapper(FieldAccessMode fieldAccessType,
boolean useAnnotations,
boolean caseInsensitiveFields,
Set<String> ignoreSet,
String view,
boolean respectIgnore,
boolean acceptSingleValueAsArray) |
Mapper(FieldsAccessor fieldsAccessor,
Set<String> ignoreSet,
String view,
boolean respectIgnore) |
Mapper(Set<String> ignoreSet) |
Mapper(Set<String> ignoreSet,
String view,
boolean respectIgnore) |
Modifier and Type | Method and Description |
---|---|
<T> List<T> |
convertListOfMapsToObjects(List<Map> list,
Class<T> componentType)
This converts a list of maps to objects.
|
<T> T |
fromList(List<?> argList,
Class<T> clazz)
Convert an item from a list into a class using the classes constructor.
|
Object |
fromMap(Map<String,Object> map)
fromMap converts a map into a Java object.
|
<T> T |
fromMap(Map<String,Object> map,
Class<T> cls)
fromMap converts a map into a java object
|
Object |
fromValueMap(Map<String,Value> valueMap)
Creates an object from a value map.
|
<T> T |
fromValueMap(Map<String,Value> valueMap,
Class<T> cls)
Creates an object from a value map.
|
List<?> |
toList(Object object)
Convert an object to a list.
|
List<Map<String,Object>> |
toListOfMaps(Collection<?> collection)
Creates a list of maps from a list of class instances.
|
Map<String,Object> |
toMap(Object object)
This could be refactored to use core.Type class and it would run faster.
|
public Mapper(FieldAccessMode fieldAccessType, boolean useAnnotations, boolean caseInsensitiveFields, Set<String> ignoreSet, String view, boolean respectIgnore, boolean acceptSingleValueAsArray)
public Mapper(FieldsAccessor fieldsAccessor, Set<String> ignoreSet, String view, boolean respectIgnore)
public Mapper(boolean acceptSingleValueAsArray)
public Mapper()
public <T> List<T> convertListOfMapsToObjects(List<Map> list, Class<T> componentType)
T
- genericslist
- the input listpublic <T> T fromMap(Map<String,Object> map, Class<T> cls)
T
- map to create teh object from.map
- map to create the object from.cls
- class type of new objectpublic <T> T fromList(List<?> argList, Class<T> clazz)
T
- genericsargList
- list if argumentsclazz
- the type of the object we are creatingpublic Object fromValueMap(Map<String,Value> valueMap)
public <T> T fromValueMap(Map<String,Value> valueMap, Class<T> cls)
cls
- the new typepublic Object fromMap(Map<String,Object> map)
map
- map to create the object from.public Map<String,Object> toMap(Object object)
object
- the object that we want to convertpublic List<Map<String,Object>> toListOfMaps(Collection<?> collection)
collection
- the collection we are coercing into a field valueCopyright © 2014. All rights reserved.