public class EntityResolver extends Object implements MappingNamespace, Serializable
EntityResolver is thread-safe.
Modifier and Type | Field and Description |
---|---|
protected LifecycleCallbackRegistry |
callbackRegistry |
protected ClassDescriptorMap |
classDescriptorMap |
protected EntityResolver |
clientEntityResolver |
protected static AtomicLong |
incrementer |
protected boolean |
indexedByClass
Deprecated.
|
protected static org.slf4j.Logger |
logger |
protected MappingNamespace |
mappingCache |
protected Collection<DataMap> |
maps |
protected ValueObjectTypeRegistry |
valueObjectTypeRegistry |
Constructor and Description |
---|
EntityResolver()
Creates new empty EntityResolver.
|
EntityResolver(Collection<DataMap> dataMaps)
Creates new EntityResolver that indexes a collection of DataMaps.
|
Modifier and Type | Method and Description |
---|---|
void |
addDataMap(DataMap map) |
void |
applyDBLayerDefaults()
Updates missing mapping artifacts that can be guessed from other mapping
information.
|
void |
applyObjectLayerDefaults()
Deprecated.
since 4.0 does nothing. Previously it used to create runtime
ObjRelationships, that broke a lot of things.
|
void |
clearCache()
Deprecated.
since 4.0 in favor of
refreshMappingCache() . |
LifecycleCallbackRegistry |
getCallbackRegistry()
Returns a
LifecycleCallbackRegistry for handling callbacks. |
ClassDescriptor |
getClassDescriptor(String entityName)
Returns ClassDescriptor for the ObjEntity matching the name.
|
ClassDescriptorMap |
getClassDescriptorMap()
Returns an object that compiles and stores
ClassDescriptor
instances for all entities. |
EntityResolver |
getClientEntityResolver()
Returns ClientEntityResolver with mapping information that only includes
entities available on CWS Client Tier.
|
DataMap |
getDataMap(String mapName)
Returns a DataMap matching the name.
|
Collection<DataMap> |
getDataMaps()
Returns an unmodifiable collection of DataMaps.
|
Collection<DbEntity> |
getDbEntities()
Returns all DbEntities.
|
DbEntity |
getDbEntity(String name)
Returns DbEntity for a given name, or null if no such DbEntity is found
in the MappingNamespace.
|
Embeddable |
getEmbeddable(String className)
Returns an
Embeddable matching class name or null if such
Embeddable is not mapped. |
Collection<Embeddable> |
getEmbeddables() |
EntityInheritanceTree |
getInheritanceTree(String entityName) |
Collection<ObjEntity> |
getObjEntities()
Returns all ObjEntities in the namespace.
|
ObjEntity |
getObjEntity(Class<?> entityClass)
Looks in the DataMap's that this object was created with for the
ObjEntity that maps to the services the specified class
|
ObjEntity |
getObjEntity(Class<?> entityClass,
boolean lookupClientResolver)
Looks in the DataMap's that this object was created with for the
ObjEntity that maps to the services the specified class, with option to
fallback to search by name with client resolver in case entity not found.
|
ObjEntity |
getObjEntity(Persistent object) |
ObjEntity |
getObjEntity(String name)
Returns ObjEntity for a given name, or null if no such ObjEntity is found
in the MappingNamespace.
|
Procedure |
getProcedure(String procedureName)
Returns Procedure for a given name, or null if no such Procedure is found
in the MappingNamespace.
|
Collection<Procedure> |
getProcedures()
Returns all Procedures in the namespace.
|
QueryDescriptor |
getQueryDescriptor(String name)
Returns a named query or null if no query exists for a given name.
|
Collection<QueryDescriptor> |
getQueryDescriptors()
Returns all Queries in the namespace.
|
SQLResult |
getResult(String name)
Returns a named result set mapping.
|
Collection<SQLResult> |
getResults() |
Collection<SQLResult> |
getResultSets()
Deprecated.
since 4.0 use
getResults() . |
ValueObjectTypeRegistry |
getValueObjectTypeRegistry() |
boolean |
isIndexedByClass()
Deprecated.
since 4.0. There's no replacement. This property is
meaningless and is no longer respected by the code.
|
EntityInheritanceTree |
lookupInheritanceTree(String entityName)
Deprecated.
since 4.0 use
getInheritanceTree(String) . |
ObjEntity |
lookupObjEntity(Class<?> entityClass)
Deprecated.
since 4.0, use
getObjEntity(Class) . |
ObjEntity |
lookupObjEntity(Object object)
Deprecated.
|
Procedure |
lookupProcedure(Query q)
Deprecated.
since 4.0. Use q.getMetaData(resolver).getProcedure()
|
Procedure |
lookupProcedure(String procedureName)
Deprecated.
since 4.0 use
getProcedure(String) . |
void |
refreshMappingCache()
Refreshes entity cache to reflect the current state of the DataMaps in
the EntityResolver.
|
void |
removeDataMap(DataMap map) |
void |
setCallbackRegistry(LifecycleCallbackRegistry callbackRegistry)
Sets a lifecycle callbacks registry of the EntityResolver.
|
void |
setDataMaps(Collection<DataMap> maps) |
void |
setEntityListenerFactory(EntityListenerFactory entityListenerFactory)
Deprecated.
since 4.0 this method does nothing, as EntityResolver no
longer loads listeners from its DataMaps.
|
void |
setIndexedByClass(boolean b)
Deprecated.
since 4.0. There's no replacement. This property is
meaningless.
|
void |
setValueObjectTypeRegistry(ValueObjectTypeRegistry valueObjectTypeRegistry) |
protected static final org.slf4j.Logger logger
protected static AtomicLong incrementer
@Deprecated protected boolean indexedByClass
protected Collection<DataMap> maps
protected transient MappingNamespace mappingCache
protected EntityResolver clientEntityResolver
protected transient volatile ClassDescriptorMap classDescriptorMap
protected transient LifecycleCallbackRegistry callbackRegistry
protected transient ValueObjectTypeRegistry valueObjectTypeRegistry
public EntityResolver()
public EntityResolver(Collection<DataMap> dataMaps)
public void applyDBLayerDefaults()
@Deprecated public void applyObjectLayerDefaults()
public LifecycleCallbackRegistry getCallbackRegistry()
LifecycleCallbackRegistry
for handling callbacks.
Registry is lazily initialized on first call.public void setCallbackRegistry(LifecycleCallbackRegistry callbackRegistry)
public EntityResolver getClientEntityResolver()
public Collection<DbEntity> getDbEntities()
getDbEntities
in interface MappingNamespace
public Collection<ObjEntity> getObjEntities()
MappingNamespace
getObjEntities
in interface MappingNamespace
public Collection<Embeddable> getEmbeddables()
getEmbeddables
in interface MappingNamespace
@Deprecated public Collection<SQLResult> getResultSets()
getResults()
.public Collection<SQLResult> getResults()
getResults
in interface MappingNamespace
public Collection<Procedure> getProcedures()
MappingNamespace
getProcedures
in interface MappingNamespace
public Collection<QueryDescriptor> getQueryDescriptors()
MappingNamespace
getQueryDescriptors
in interface MappingNamespace
public DbEntity getDbEntity(String name)
MappingNamespace
getDbEntity
in interface MappingNamespace
public ObjEntity getObjEntity(String name)
MappingNamespace
getObjEntity
in interface MappingNamespace
public Procedure getProcedure(String procedureName)
MappingNamespace
getProcedure
in interface MappingNamespace
public QueryDescriptor getQueryDescriptor(String name)
getQueryDescriptor
in interface MappingNamespace
public Embeddable getEmbeddable(String className)
MappingNamespace
Embeddable
matching class name or null if such
Embeddable is not mapped.getEmbeddable
in interface MappingNamespace
public SQLResult getResult(String name)
MappingNamespace
getResult
in interface MappingNamespace
public ClassDescriptor getClassDescriptor(String entityName)
public void addDataMap(DataMap map)
@Deprecated public void clearCache()
refreshMappingCache()
.public void refreshMappingCache()
public void setDataMaps(Collection<DataMap> maps)
public Collection<DataMap> getDataMaps()
public EntityInheritanceTree getInheritanceTree(String entityName)
getInheritanceTree
in interface MappingNamespace
@Deprecated public EntityInheritanceTree lookupInheritanceTree(String entityName)
getInheritanceTree(String)
.public ObjEntity getObjEntity(Class<?> entityClass)
getObjEntity
in interface MappingNamespace
public ObjEntity getObjEntity(Class<?> entityClass, boolean lookupClientResolver)
Looks in the DataMap's that this object was created with for the ObjEntity that maps to the services the specified class, with option to fallback to search by name with client resolver in case entity not found.
This method can be used where entity class can be received from client.
entityClass
- entity class to searchlookupClientResolver
- flag to fallback to client resolverpublic ObjEntity lookupObjEntity(Class<?> entityClass)
getObjEntity(Class)
.public ObjEntity getObjEntity(Persistent object)
getObjEntity
in interface MappingNamespace
@Deprecated public ObjEntity lookupObjEntity(Object object)
@Deprecated public Procedure lookupProcedure(Query q)
@Deprecated public Procedure lookupProcedure(String procedureName)
getProcedure(String)
.public void removeDataMap(DataMap map)
@Deprecated public boolean isIndexedByClass()
public void setIndexedByClass(boolean b)
public ClassDescriptorMap getClassDescriptorMap()
ClassDescriptor
instances for all entities.@Deprecated public void setEntityListenerFactory(EntityListenerFactory entityListenerFactory)
public ValueObjectTypeRegistry getValueObjectTypeRegistry()
public void setValueObjectTypeRegistry(ValueObjectTypeRegistry valueObjectTypeRegistry)
Copyright © 2001–2019 Apache Cayenne. All rights reserved.