|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.map.EntityResolver
public class EntityResolver
Represents a virtual shared namespace for zero or more DataMaps. Unlike DataMap, EntityResolver is intended to work as a runtime container of mapping. DataMaps can be added or removed dynamically at runtime.
EntityResolver is thread-safe.
Field Summary | |
---|---|
protected LifecycleCallbackRegistry |
callbackRegistry
|
protected ClassDescriptorMap |
classDescriptorMap
|
protected EntityResolver |
clientEntityResolver
|
protected Map |
dbEntityCache
|
protected Map |
embeddableCache
|
protected Map |
entityInheritanceCache
|
protected Map |
entityListenerCache
|
protected boolean |
indexedByClass
|
protected List |
maps
|
protected Map |
objEntityCache
|
protected Map |
procedureCache
|
protected Map |
queryCache
|
Constructor Summary | |
---|---|
EntityResolver()
Creates new EntityResolver. |
|
EntityResolver(Collection dataMaps)
Creates new EntityResolver that indexes a collection of DataMaps. |
Method Summary | |
---|---|
protected DbEntity |
_lookupDbEntity(Object object)
Internal usage only - provides the type-unsafe implementation which services the four typesafe public lookupDbEntity methods Looks in the DataMap's that this object was created with for the ObjEntity that maps to the specified object. |
protected ObjEntity |
_lookupObjEntity(String key)
Internal usage only - provides the type-unsafe implementation which services the three typesafe public lookupObjEntity methods Looks in the DataMap's that this object was created with for the ObjEntity that maps to the specified object. |
void |
addDataMap(DataMap map)
|
protected String |
classKey(String className)
Generates a map key for the object class. |
void |
clearCache()
Removes all entity mappings from the cache. |
protected void |
constructCache()
Creates caches of DbEntities by ObjEntity, DataObject class, and ObjEntity name using internal list of maps. |
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 |
getDataMaps()
Returns an unmodifiable collection of DataMaps. |
Collection |
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. |
EntityListener |
getEntityListener(String className)
Returns an EntityListener matching class name or null if such
EntityListener is not mapped. |
Collection |
getObjEntities()
Returns all ObjEntities in the namespace. |
ObjEntity |
getObjEntity(String name)
Returns ObjEntity for a given name, or null if no such ObjEntity is found in the MappingNamespace. |
Procedure |
getProcedure(String name)
Returns Procedure for a given name, or null if no such Procedure is found in the MappingNamespace. |
Collection |
getProcedures()
Returns all Procedures in the namespace. |
Collection |
getQueries()
Returns all Queries in the namespace. |
Query |
getQuery(String name)
Returns Query for a given name, or null if no such Query is found in the MappingNamespace. |
boolean |
isIndexedByClass()
|
DbEntity |
lookupDbEntity(Class aClass)
Deprecated. since 3.0 - lookup DbEntity via ObjEntity instead. |
DbEntity |
lookupDbEntity(Persistent dataObject)
Deprecated. since 3.0 - lookup DbEntity via ObjEntity instead. |
EntityInheritanceTree |
lookupInheritanceTree(ObjEntity entity)
Returns EntityInheritanceTree representing inheritance hierarchy that starts with a given ObjEntity as root, and includes all its subentities. |
ObjEntity |
lookupObjEntity(Class aClass)
Looks in the DataMap's that this object was created with for the ObjEntity that maps to the services the specified class |
ObjEntity |
lookupObjEntity(Object object)
Looks in the DataMap's that this object was created with for the ObjEntity that services the specified data Object |
ObjEntity |
lookupObjEntity(String entityName)
Deprecated. since 3.0 - use getObjEntity() instead. |
Procedure |
lookupProcedure(Query q)
|
Procedure |
lookupProcedure(String procedureName)
|
Query |
lookupQuery(String name)
Returns a named query or null if no query exists for a given name. |
void |
removeDataMap(DataMap map)
|
void |
setDataMaps(Collection maps)
|
void |
setIndexedByClass(boolean b)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean indexedByClass
protected transient Map queryCache
protected transient Map embeddableCache
protected transient Map entityListenerCache
protected transient Map dbEntityCache
protected transient Map objEntityCache
protected transient Map procedureCache
protected List maps
protected transient Map entityInheritanceCache
protected EntityResolver clientEntityResolver
protected transient ClassDescriptorMap classDescriptorMap
protected transient LifecycleCallbackRegistry callbackRegistry
Constructor Detail |
---|
public EntityResolver()
public EntityResolver(Collection dataMaps)
Method Detail |
---|
public LifecycleCallbackRegistry getCallbackRegistry()
LifecycleCallbackRegistry
for handling callbacks. Registry is
lazily initialized on first call.
public EntityResolver getClientEntityResolver()
public Collection getDbEntities()
getDbEntities
in interface MappingNamespace
public Collection getObjEntities()
MappingNamespace
getObjEntities
in interface MappingNamespace
public Collection getProcedures()
MappingNamespace
getProcedures
in interface MappingNamespace
public Collection getQueries()
MappingNamespace
getQueries
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 name)
MappingNamespace
getProcedure
in interface MappingNamespace
public Query getQuery(String name)
MappingNamespace
getQuery
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 EntityListener getEntityListener(String className)
MappingNamespace
EntityListener
matching class name or null if such
EntityListener is not mapped.
getEntityListener
in interface MappingNamespace
public ClassDescriptor getClassDescriptor(String entityName)
public void addDataMap(DataMap map)
public void clearCache()
constructCache
, or on demand by calling any of the
lookup...
methods.
protected void constructCache()
public DataMap getDataMap(String mapName)
public void setDataMaps(Collection maps)
public Collection getDataMaps()
public DbEntity lookupDbEntity(Class aClass)
public DbEntity lookupDbEntity(Persistent dataObject)
public EntityInheritanceTree lookupInheritanceTree(ObjEntity entity)
public ObjEntity lookupObjEntity(Class aClass)
public ObjEntity lookupObjEntity(Object object)
public ObjEntity lookupObjEntity(String entityName)
public Procedure lookupProcedure(Query q)
public Procedure lookupProcedure(String procedureName)
public Query lookupQuery(String name)
public void removeDataMap(DataMap map)
public boolean isIndexedByClass()
public void setIndexedByClass(boolean b)
protected String classKey(String className)
protected DbEntity _lookupDbEntity(Object object)
protected ObjEntity _lookupObjEntity(String key)
public ClassDescriptorMap getClassDescriptorMap()
ClassDescriptor
instances for
all entities.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |