@Named public class OrientBeanMapperImpl extends AbstractDocumentBeanMapper<com.orientechnologies.orient.core.record.impl.ODocument,OrientBean,OrientBeanMapperImpl.OrientClass> implements OrientBeanMapper
OrientBeanMapper
.Modifier and Type | Class and Description |
---|---|
protected class |
OrientBeanMapperImpl.OrientClass
Simple container for
OrientBean meta-data. |
AbstractDocumentBeanMapper.Mapping<D,B extends Bean>
Modifier and Type | Field and Description |
---|---|
private Map<Integer,OrientBeanMapperImpl.OrientClass> |
clusterId2OrientClassMap |
private OrientMappingConfigProperties |
config |
private OrientBean |
documentPrototype |
private static Bean[] |
NO_BEANS |
private static String |
PACKAGE_PREFIX |
private PropertyBuilder |
propertyBuilder |
private ReflectionUtil |
reflectionUtil |
Constructor and Description |
---|
OrientBeanMapperImpl()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
com.orientechnologies.orient.core.id.ORID |
convertId(Id<? extends OrientBean> id) |
private OrientBeanMapperImpl.OrientClass |
createMapping(com.orientechnologies.orient.core.metadata.schema.OClass oClass) |
protected OrientBeanMapperImpl.OrientClass |
createMapping(OrientBean bean)
Override to create dynamic
AbstractDocumentBeanMapper.Mapping s on the fly. |
protected OrientBeanMapperImpl.OrientClass |
createMapping(String key,
com.orientechnologies.orient.core.record.impl.ODocument document)
Override to create dynamic
AbstractDocumentBeanMapper.Mapping s on the fly. |
protected void |
doInitialize()
This method performs the actual
initialization . |
<B extends OrientBean> |
getBeanPrototype(Class<B> type) |
OrientBean |
getBeanPrototype(int clusterId) |
OrientBean |
getBeanPrototype(com.orientechnologies.orient.core.metadata.schema.OClass oClass) |
protected String |
getKey(com.orientechnologies.orient.core.metadata.schema.OClass oClass) |
protected String |
getKey(com.orientechnologies.orient.core.record.impl.ODocument document) |
protected String |
getKey(OrientBean bean) |
com.orientechnologies.orient.core.metadata.schema.OClass |
getOClass(Class<? extends OrientBean> beanClass) |
protected OrientBeanMapperImpl.OrientClass |
getOrCreateMapping(Class<? extends OrientBean> type) |
protected OrientBeanMapperImpl.OrientClass |
getOrCreateMapping(com.orientechnologies.orient.core.metadata.schema.OClass oClass) |
private void |
initClass(OrientBeanMapperImpl.OrientClass orientClass) |
private boolean |
isAbstract(OrientBean prototype) |
private boolean |
isAcceptedProperty(com.orientechnologies.orient.core.metadata.schema.OProperty oProperty) |
protected void |
mapPropertiesFromBean(OrientBean bean,
com.orientechnologies.orient.core.record.impl.ODocument document) |
protected void |
mapPropertiesToBean(com.orientechnologies.orient.core.record.impl.ODocument document,
OrientBean bean) |
private OrientBeanMapperImpl.OrientClass |
register(Class<? extends OrientBean> beanClass) |
protected void |
registerBean(Class<? extends OrientBean> beanClass) |
protected void |
registerDefaults()
Registers the default OrientBean s for the standard schema types. |
void |
setConfig(OrientMappingConfigProperties config) |
void |
setPropertyBuilder(PropertyBuilder propertyBuilder) |
void |
setReflectionUtil(ReflectionUtil reflectionUtil) |
void |
syncClass(com.orientechnologies.orient.core.metadata.schema.OClass oClass)
Synchronizes a
OrientDB class with the according OrientBean . |
private com.orientechnologies.orient.core.metadata.schema.OClass |
syncClass(OrientBeanMapperImpl.OrientClass orientClass,
com.orientechnologies.orient.core.metadata.schema.OSchemaProxy schema) |
void |
syncSchema(com.orientechnologies.orient.core.metadata.schema.OSchemaProxy schema)
Synchronizes the
OrientDB schema with the Java data model . |
addMapping, addMapping, fromBean, getMapping, getMappings, getOrCreateMapping, getOrCreateMapping, toBean
getBeanFactory, getBeanPrototypeBuilder, setBeanFactory, setBeanPrototypeBuilder
createLogger, getLogger
doInitialized, getInitializationState, initialize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fromBean, toBean
private static final String PACKAGE_PREFIX
private static final Bean[] NO_BEANS
private final Map<Integer,OrientBeanMapperImpl.OrientClass> clusterId2OrientClassMap
private PropertyBuilder propertyBuilder
private ReflectionUtil reflectionUtil
private OrientBean documentPrototype
private OrientMappingConfigProperties config
@Inject public void setPropertyBuilder(PropertyBuilder propertyBuilder)
propertyBuilder
- the PropertyBuilder
to Inject
.@Inject public void setReflectionUtil(ReflectionUtil reflectionUtil)
reflectionUtil
- the ReflectionUtil
to Inject
.@Inject public void setConfig(OrientMappingConfigProperties config)
config
- the OrientMappingConfigProperties
to Inject
.protected void doInitialize()
AbstractComponent
initialization
. It is called when AbstractComponent.initialize()
is
invoked for the first time. super.
AbstractComponent.doInitialize()
.doInitialize
in class AbstractBeanMapper<com.orientechnologies.orient.core.record.impl.ODocument,OrientBean>
private void initClass(OrientBeanMapperImpl.OrientClass orientClass)
protected void registerDefaults()
Registers
the default OrientBean
s for the standard schema types.protected void registerBean(Class<? extends OrientBean> beanClass)
beanClass
- the OrientBean
to register.private OrientBeanMapperImpl.OrientClass register(Class<? extends OrientBean> beanClass)
public OrientBean getBeanPrototype(int clusterId)
getBeanPrototype
in interface OrientBeanMapper
clusterId
- the cluster ID
.OrientBean
prototype
.public void syncSchema(com.orientechnologies.orient.core.metadata.schema.OSchemaProxy schema)
OrientBeanMapper
OrientDB schema
with the Java data model
.syncSchema
in interface OrientBeanMapper
schema
- the OSchemaProxy
.OrientBeanMapper.syncClass(OClass)
private com.orientechnologies.orient.core.metadata.schema.OClass syncClass(OrientBeanMapperImpl.OrientClass orientClass, com.orientechnologies.orient.core.metadata.schema.OSchemaProxy schema)
public void syncClass(com.orientechnologies.orient.core.metadata.schema.OClass oClass)
OrientBeanMapper
OrientDB class
with the according OrientBean
.syncClass
in interface OrientBeanMapper
oClass
- the OClass
to synchronize.private boolean isAcceptedProperty(com.orientechnologies.orient.core.metadata.schema.OProperty oProperty)
private boolean isAbstract(OrientBean prototype)
private OrientBeanMapperImpl.OrientClass createMapping(com.orientechnologies.orient.core.metadata.schema.OClass oClass)
public OrientBean getBeanPrototype(com.orientechnologies.orient.core.metadata.schema.OClass oClass)
getBeanPrototype
in interface OrientBeanMapper
oClass
- the OrientDB class
to map.OrientBean
prototype
.public <B extends OrientBean> B getBeanPrototype(Class<B> type)
getBeanPrototype
in interface OrientBeanMapper
B
- the generic type of the OrientBean
.type
- the Class
reflecting the OrientBean
-interface to get the prototype for.OrientBean
prototype
.public com.orientechnologies.orient.core.metadata.schema.OClass getOClass(Class<? extends OrientBean> beanClass)
getOClass
in interface OrientBeanMapper
beanClass
- the OrientBean
-Class
.OClass
.protected void mapPropertiesFromBean(OrientBean bean, com.orientechnologies.orient.core.record.impl.ODocument document)
mapPropertiesFromBean
in class AbstractDocumentBeanMapper<com.orientechnologies.orient.core.record.impl.ODocument,OrientBean,OrientBeanMapperImpl.OrientClass>
bean
- the Bean
to map.document
- the document to map to.protected void mapPropertiesToBean(com.orientechnologies.orient.core.record.impl.ODocument document, OrientBean bean)
mapPropertiesToBean
in class AbstractDocumentBeanMapper<com.orientechnologies.orient.core.record.impl.ODocument,OrientBean,OrientBeanMapperImpl.OrientClass>
document
- the document to map.bean
- the Bean
-instance to map to.protected String getKey(OrientBean bean)
getKey
in class AbstractDocumentBeanMapper<com.orientechnologies.orient.core.record.impl.ODocument,OrientBean,OrientBeanMapperImpl.OrientClass>
bean
- the Bean
.AbstractDocumentBeanMapper.getMapping(String)
.protected String getKey(com.orientechnologies.orient.core.record.impl.ODocument document)
getKey
in class AbstractDocumentBeanMapper<com.orientechnologies.orient.core.record.impl.ODocument,OrientBean,OrientBeanMapperImpl.OrientClass>
document
- the document to map.qualified name
of the corresponding Bean
.protected String getKey(com.orientechnologies.orient.core.metadata.schema.OClass oClass)
oClass
- the OClass
.getKey(ODocument)
protected OrientBeanMapperImpl.OrientClass getOrCreateMapping(com.orientechnologies.orient.core.metadata.schema.OClass oClass)
oClass
- the OClass
.OrientBeanMapperImpl.OrientClass
.protected OrientBeanMapperImpl.OrientClass getOrCreateMapping(Class<? extends OrientBean> type)
type
- the Class
reflecting the OrientBean
.OrientBeanMapperImpl.OrientClass
.protected OrientBeanMapperImpl.OrientClass createMapping(OrientBean bean)
AbstractDocumentBeanMapper
AbstractDocumentBeanMapper.Mapping
s on the fly.createMapping
in class AbstractDocumentBeanMapper<com.orientechnologies.orient.core.record.impl.ODocument,OrientBean,OrientBeanMapperImpl.OrientClass>
bean
- the Bean
to map.AbstractDocumentBeanMapper.Mapping
that is not yet defined and will be registered
and cached
for further invocations.protected OrientBeanMapperImpl.OrientClass createMapping(String key, com.orientechnologies.orient.core.record.impl.ODocument document)
AbstractDocumentBeanMapper
AbstractDocumentBeanMapper.Mapping
s on the fly.createMapping
in class AbstractDocumentBeanMapper<com.orientechnologies.orient.core.record.impl.ODocument,OrientBean,OrientBeanMapperImpl.OrientClass>
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.public com.orientechnologies.orient.core.id.ORID convertId(Id<? extends OrientBean> id)
convertId
in interface OrientBeanMapper
id
- the Id
to convert.Id
as ORID
.Copyright © 2001–2016 mmm-Team. All rights reserved.