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 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.
|
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() |
ValueObjectTypeRegistry |
getValueObjectTypeRegistry() |
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 |
setValueObjectTypeRegistry(ValueObjectTypeRegistry valueObjectTypeRegistry) |
protected static final org.slf4j.Logger logger
protected static AtomicLong incrementer
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()
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
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)
public void refreshMappingCache()
public void setDataMaps(Collection<DataMap> maps)
public Collection<DataMap> getDataMaps()
public EntityInheritanceTree getInheritanceTree(String entityName)
getInheritanceTree
in interface MappingNamespace
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 getObjEntity(Persistent object)
getObjEntity
in interface MappingNamespace
public void removeDataMap(DataMap map)
public ClassDescriptorMap getClassDescriptorMap()
ClassDescriptor
instances for all entities.public ValueObjectTypeRegistry getValueObjectTypeRegistry()
public void setValueObjectTypeRegistry(ValueObjectTypeRegistry valueObjectTypeRegistry)
Copyright © 2001–2019 Apache Cayenne. All rights reserved.