public final class FieldMapper<T> extends Object
A tool for creating Maps that represent the fields of a given instance of a particular type.
To get an Instance use simple(Class) or FieldMapper.Stage.apply(Class)
stage(Function)| Modifier and Type | Class and Description |
|---|---|
static class |
FieldMapper.Stage
Represents a preliminary stage of a
FieldMapper. |
| Modifier and Type | Method and Description |
|---|---|
Function<T,T> |
copyTo(T target)
Returns a
Function that can copy the fields of an origin to a given target instance of the
associated type and return that instance. |
Map<String,Object> |
map(T subject)
Returns a
Map representation for the given subject that corresponds to the template of this FieldMapper. |
Function<Map<?,?>,T> |
mapTo(T target)
|
static <T> FieldMapper<T> |
simple(Class<T> type)
Returns a
FieldMapper that can represent all significant fields of an instance as a
Map. |
static FieldMapper.Stage |
stage(Function<Class<?>,Map<String,Field>> mapping)
Returns a new
FieldMapper.Stage. |
public static FieldMapper.Stage stage(Function<Class<?>,Map<String,Field>> mapping)
FieldMapper.Stage.public static <T> FieldMapper<T> simple(Class<T> type)
Returns a FieldMapper that can represent all significant fields of an instance as a
Map.
Significant are all fields of the given class and its superclasses, which are not static and not transient.
public final Map<String,Object> map(T subject)
Map representation for the given subject that corresponds to the template of this FieldMapper.public final Function<T,T> copyTo(T target)
Function that can copy the fields of an origin to a given target instance of the
associated type and return that instance.Copyright © 2019. All rights reserved.