D - the type of the document (generic container object) to map (e.g. a document from a CMS or NoSQL-database).B - the base type of the Bean to map (e.g. Bean or EntityBean).M - the generic type of the internal AbstractDocumentBeanMapper.Mapping.public abstract class AbstractDocumentBeanMapper<D,B extends Bean,M extends AbstractDocumentBeanMapper.Mapping<D,B>> extends AbstractBeanMapper<D,B> implements DocumentBeanMapper<D,B>
DocumentBeanMapper.| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractDocumentBeanMapper.Mapping<D,B extends Bean>
Simple container for
Bean meta-data. |
| Constructor and Description |
|---|
AbstractDocumentBeanMapper()
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addMapping(M mapping) |
protected void |
addMapping(String key,
M mapping) |
protected M |
createMapping(B bean)
Override to create dynamic
AbstractDocumentBeanMapper.Mappings on the fly. |
protected M |
createMapping(String key,
D document)
Override to create dynamic
AbstractDocumentBeanMapper.Mappings on the fly. |
D |
fromBean(B bean) |
protected String |
getKey(B bean) |
protected abstract String |
getKey(D document) |
protected M |
getMapping(String key) |
protected Collection<M> |
getMappings() |
protected M |
getOrCreateMapping(B bean) |
protected M |
getOrCreateMapping(String key,
Function<String,M> function) |
protected abstract void |
mapPropertiesFromBean(B bean,
D document) |
protected abstract void |
mapPropertiesToBean(D document,
B bean) |
<T extends B> |
toBean(D document) |
doInitialize, getBeanFactory, getBeanPrototypeBuilder, setBeanFactory, setBeanPrototypeBuildercreateLogger, getLoggerdoInitialized, getInitializationState, initializeprotected void addMapping(M mapping)
mapping - the AbstractDocumentBeanMapper.Mapping to register (put into concurrent map to cache).protected final void addMapping(String key, M mapping)
key - the key used to store the AbstractDocumentBeanMapper.Mapping.mapping - the AbstractDocumentBeanMapper.Mapping to store.addMapping(Mapping)protected final M getMapping(String key)
key - the key of the requested AbstractDocumentBeanMapper.Mapping.AbstractDocumentBeanMapper.Mapping. May be null.protected final Collection<M> getMappings()
Collection of AbstractDocumentBeanMapper.Mappings.public D fromBean(B bean)
fromBean in interface DocumentBeanMapper<D,B extends Bean>bean - the Bean to map.new instance of the document (generic container object) with the
properties mapped from the given Bean.protected final M getOrCreateMapping(B bean)
bean - the Bean to get the AbstractDocumentBeanMapper.Mapping for.AbstractDocumentBeanMapper.Mapping. Will be created by createMapping(Bean) if not yet exists.protected String getKey(B bean)
bean - the Bean.getMapping(String).protected M createMapping(B bean)
AbstractDocumentBeanMapper.Mappings on the fly.bean - the Bean to map.AbstractDocumentBeanMapper.Mapping that is not yet defined and will be registered and cached
for further invocations.protected abstract void mapPropertiesFromBean(B bean, D document)
bean - the Bean to map.document - the document to map to.protected final M getOrCreateMapping(String key, Function<String,M> function)
key - the key of the requested AbstractDocumentBeanMapper.Mapping.function - the Function to create the AbstractDocumentBeanMapper.Mapping in case it does
not already exist.AbstractDocumentBeanMapper.Mapping.protected abstract void mapPropertiesToBean(D document, B bean)
document - the document to map.bean - the Bean-instance to map to.protected M createMapping(String key, D document)
AbstractDocumentBeanMapper.Mappings on the fly.key - the qualified name for the document.document - the document to map.AbstractDocumentBeanMapper.Mapping that is not yet defined and will be registered and cached
for further invocations.protected abstract String getKey(D document)
document - the document to map.qualified name of the corresponding Bean.Copyright © 2001–2016 mmm-Team. All rights reserved.