|
|||||||||
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 ClassDescriptorFactory |
classDescriptorFactory
|
protected EntityResolver |
clientEntityResolver
|
protected java.util.Map |
dbEntityCache
|
protected java.util.Map |
entityInheritanceCache
|
protected boolean |
indexedByClass
|
protected java.util.List |
maps
|
protected java.util.Map |
objEntityCache
|
protected java.util.Map |
procedureCache
|
protected java.util.Map |
queryCache
|
Constructor Summary | |
---|---|
EntityResolver()
Creates new EntityResolver. |
|
EntityResolver(java.util.Collection dataMaps)
Creates new EntityResolver that indexes a collection of DataMaps. |
Method Summary | |
---|---|
protected DbEntity |
_lookupDbEntity(java.lang.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(java.lang.Object object)
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)
|
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. |
ClassDescriptor |
getClassDescriptor(java.lang.String entityName)
Returns ClassDescriptor for the ObjEntity matching the name. |
ClassDescriptorFactory |
getClassDescriptorFactory()
Returns a factory for ClassDescriptors used by Cayenne stack. |
EntityResolver |
getClientEntityResolver()
Returns ClientEntityResolver with mapping information that only includes entities available on CWS Client Tier. |
DataMap |
getDataMap(java.lang.String mapName)
Returns a DataMap matching the name. |
java.util.Collection |
getDataMaps()
Returns an unmodifiable collection of DataMaps. |
java.util.Collection |
getDbEntities()
Returns all DbEntities. |
DbEntity |
getDbEntity(java.lang.String name)
Returns DbEntity for a given name, or null if no such DbEntity is found in the MappingNamespace. |
java.util.Collection |
getObjEntities()
Returns all ObjEntities in the namespace. |
ObjEntity |
getObjEntity(java.lang.String name)
Returns ObjEntity for a given name, or null if no such ObjEntity is found in the MappingNamespace. |
Procedure |
getProcedure(java.lang.String name)
Returns Procedure for a given name, or null if no such Procedure is found in the MappingNamespace. |
java.util.Collection |
getProcedures()
Returns all Procedures in the namespace. |
java.util.Collection |
getQueries()
Returns all Queries in the namespace. |
Query |
getQuery(java.lang.String name)
Returns Query for a given name, or null if no such Query is found in the MappingNamespace. |
boolean |
isIndexedByClass()
|
DataMap |
lookupDataMap(Query q)
Deprecated. since 1.2 use 'Query.getMetaData(EntityResolver).getDataMap()'. |
DbEntity |
lookupDbEntity(java.lang.Class aClass)
Looks in the DataMap's that this object was created with for the DbEntity that services the specified class |
DbEntity |
lookupDbEntity(Persistent dataObject)
Looks in the DataMap's that this object was created with for the DbEntity that services the specified data Object |
DbEntity |
lookupDbEntity(Query q)
Deprecated. since 1.2 use 'Query.getMetaData(EntityResolver).getDbEntity()' |
EntityInheritanceTree |
lookupInheritanceTree(ObjEntity entity)
Returns EntityInheritanceTree representing inheritance hierarchy that starts with a given ObjEntity as root, and includes all its subentities. |
ObjEntity |
lookupObjEntity(java.lang.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(Persistent dataObject)
Looks in the DataMap's that this object was created with for the ObjEntity that services the specified data Object |
ObjEntity |
lookupObjEntity(Query q)
Deprecated. since 1.2 use 'Query.getMetaData(EntityResolver).getObjEntity()'. |
ObjEntity |
lookupObjEntity(java.lang.String entityName)
Looks in the DataMap's that this object was created with for the ObjEntity that maps to the services the class with the given name |
Procedure |
lookupProcedure(Query q)
|
Procedure |
lookupProcedure(java.lang.String procedureName)
|
Query |
lookupQuery(java.lang.String name)
Returns a named query or null if no query exists for a given name. |
void |
removeDataMap(DataMap map)
|
void |
setClassDescriptorFactory(ClassDescriptorFactory descriptorFactory)
Sets a factory for ClassDescriptors used by Cayenne stack. |
void |
setDataMaps(java.util.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 java.util.Map queryCache
protected java.util.Map dbEntityCache
protected java.util.Map objEntityCache
protected java.util.Map procedureCache
protected java.util.List maps
protected java.util.Map entityInheritanceCache
protected EntityResolver clientEntityResolver
protected transient ClassDescriptorFactory classDescriptorFactory
Constructor Detail |
---|
public EntityResolver()
public EntityResolver(java.util.Collection dataMaps)
Method Detail |
---|
public EntityResolver getClientEntityResolver()
public java.util.Collection getDbEntities()
getDbEntities
in interface MappingNamespace
public java.util.Collection getObjEntities()
MappingNamespace
getObjEntities
in interface MappingNamespace
public java.util.Collection getProcedures()
MappingNamespace
getProcedures
in interface MappingNamespace
public java.util.Collection getQueries()
MappingNamespace
getQueries
in interface MappingNamespace
public DbEntity getDbEntity(java.lang.String name)
MappingNamespace
getDbEntity
in interface MappingNamespace
public ObjEntity getObjEntity(java.lang.String name)
MappingNamespace
getObjEntity
in interface MappingNamespace
public Procedure getProcedure(java.lang.String name)
MappingNamespace
getProcedure
in interface MappingNamespace
public Query getQuery(java.lang.String name)
MappingNamespace
getQuery
in interface MappingNamespace
public ClassDescriptor getClassDescriptor(java.lang.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(java.lang.String mapName)
public void setDataMaps(java.util.Collection maps)
public java.util.Collection getDataMaps()
public DataMap lookupDataMap(Query q)
public DbEntity lookupDbEntity(java.lang.Class aClass)
public DbEntity lookupDbEntity(Persistent dataObject)
public DbEntity lookupDbEntity(Query q)
public EntityInheritanceTree lookupInheritanceTree(ObjEntity entity)
public ObjEntity lookupObjEntity(java.lang.Class aClass)
public ObjEntity lookupObjEntity(Persistent dataObject)
public ObjEntity lookupObjEntity(Query q)
CayenneRuntimeException
- if the root of the query is a DbEntity (it is not
reliably possible to map from a DbEntity to an ObjEntity as a DbEntity
may be the source for multiple ObjEntities. It is not safe to rely on
such behaviour).public ObjEntity lookupObjEntity(java.lang.String entityName)
public Procedure lookupProcedure(Query q)
public Procedure lookupProcedure(java.lang.String procedureName)
public Query lookupQuery(java.lang.String name)
public void removeDataMap(DataMap map)
public boolean isIndexedByClass()
public void setIndexedByClass(boolean b)
protected DbEntity _lookupDbEntity(java.lang.Object object)
protected ObjEntity _lookupObjEntity(java.lang.Object object)
public ClassDescriptorFactory getClassDescriptorFactory()
EntityDescriptorFactory
.
public void setClassDescriptorFactory(ClassDescriptorFactory descriptorFactory)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |