Package ome.util
Class ModelMapper
- java.lang.Object
-
- ome.util.ContextFilter
-
- ome.util.ModelMapper
-
- All Implemented Interfaces:
Filter
public abstract class ModelMapper extends ContextFilter
- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Logger
log
protected java.util.Map
model2target
-
Fields inherited from class ome.util.ContextFilter
_cache, _context
-
-
Constructor Summary
Constructors Constructor Description ModelMapper()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.util.Map
c2c()
TODO identity versus null mappingsjava.sql.Timestamp
event2timestamp(Event event)
java.util.Collection
filter(java.lang.String fieldId, java.util.Collection source)
iterates over the contents of the collection and filters each.java.util.Map
filter(java.lang.String fieldId, java.util.Map source)
filters both the key and value sets of the map.Filterable
filter(java.lang.String fieldId, Filterable source)
protected java.lang.Class
findClass(java.lang.Class source)
java.util.Collection
findCollection(java.util.Collection source)
java.lang.Object
findCollectionTarget(java.lang.Object current)
extension point which subclasses can override to better map the values of collections and maps.java.lang.Object
findKeyTarget(java.lang.Object current)
extension point which subclasses can override to better map the keys of maps.java.util.Map
findMap(java.util.Map source)
java.lang.Object
findTarget(java.lang.Object current)
known immutables are return unchanged.java.util.Collection
map(java.util.Collection source)
java.util.Map
map(java.util.Map source)
ModelBased
map(Filterable source)
double
nullSafeDouble(java.lang.Double d)
float
nullSafeFloat(java.lang.Float f)
int
nullSafeInt(java.lang.Integer i)
long
nullSafeLong(java.lang.Long l)
static java.lang.String
stackAsString(java.lang.Throwable t)
-
Methods inherited from class ome.util.ContextFilter
addSeen, afterFilter, beforeFilter, currentContext, doFilter, doFilter, doFilter, enter, exit, filter, filter, hasntSeen, pop, previousContext, push
-
-
-
-
Method Detail
-
c2c
protected abstract java.util.Map c2c()
TODO identity versus null mappings- Returns:
- a map from
IObject
classesModelBased
classes.
-
map
public ModelBased map(Filterable source)
-
map
public java.util.Collection map(java.util.Collection source)
-
map
public java.util.Map map(java.util.Map source)
-
filter
public Filterable filter(java.lang.String fieldId, Filterable source)
- Specified by:
filter
in interfaceFilter
- Overrides:
filter
in classContextFilter
-
filter
public java.util.Collection filter(java.lang.String fieldId, java.util.Collection source)
Description copied from class:ContextFilter
iterates over the contents of the collection and filters each. Adds itself to the context. This is somewhat dangerous.- Specified by:
filter
in interfaceFilter
- Overrides:
filter
in classContextFilter
-
filter
public java.util.Map filter(java.lang.String fieldId, java.util.Map source)
Description copied from class:ContextFilter
filters both the key and value sets of the map. Adds itself to the context. Somewhat dangerous.- Specified by:
filter
in interfaceFilter
- Overrides:
filter
in classContextFilter
-
findClass
protected java.lang.Class findClass(java.lang.Class source)
-
findKeyTarget
public java.lang.Object findKeyTarget(java.lang.Object current)
extension point which subclasses can override to better map the keys of maps.
-
findCollectionTarget
public java.lang.Object findCollectionTarget(java.lang.Object current)
extension point which subclasses can override to better map the values of collections and maps.
-
findTarget
public java.lang.Object findTarget(java.lang.Object current)
known immutables are return unchanged.- Parameters:
current
-- Returns:
- a possibly uninitialized object which will be finalized as the object graph is walked.
-
findCollection
public java.util.Collection findCollection(java.util.Collection source)
-
findMap
public java.util.Map findMap(java.util.Map source)
-
event2timestamp
public java.sql.Timestamp event2timestamp(Event event)
-
nullSafeInt
public int nullSafeInt(java.lang.Integer i)
-
nullSafeLong
public long nullSafeLong(java.lang.Long l)
-
nullSafeDouble
public double nullSafeDouble(java.lang.Double d)
-
nullSafeFloat
public float nullSafeFloat(java.lang.Float f)
-
stackAsString
public static java.lang.String stackAsString(java.lang.Throwable t)
-
-