|
||||||||||
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 EntityListenerFactory |
entityListenerFactory
|
protected boolean |
indexedByClass
Deprecated. |
protected static org.apache.commons.logging.Log |
logger
|
protected MappingNamespace |
mappingCache
|
protected Collection<DataMap> |
maps
|
Constructor Summary | |
---|---|
EntityResolver()
Creates new empty EntityResolver. |
|
EntityResolver(Collection<DataMap> dataMaps)
Creates new EntityResolver that indexes a collection of DataMaps. |
Method Summary | |
---|---|
void |
addDataMap(DataMap map)
|
void |
applyDBLayerDefaults()
Updates missing mapping artifacts that can be guessed from other mapping information. |
void |
applyObjectLayerDefaults()
Updates missing mapping artifacts that can be guessed from other mapping information. |
void |
clearCache()
Deprecated. since 3.2 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(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. |
Collection<Query> |
getQueries()
Returns all Queries in the namespace. |
Query |
getQuery(String name)
Returns a named query or null if no query exists for a given name. |
SQLResult |
getResult(String name)
Returns a named result set mapping. |
Collection<SQLResult> |
getResults()
|
Collection<SQLResult> |
getResultSets()
Deprecated. since 3.2 use getResults() . |
boolean |
isIndexedByClass()
Deprecated. since 3.2. There's no replacement. This property is meaningless and is no longer respected by the code. |
EntityInheritanceTree |
lookupInheritanceTree(String entityName)
Deprecated. since 3.2 use getInheritanceTree(String) . |
ObjEntity |
lookupObjEntity(Class<?> entityClass)
Deprecated. since 3.2, use getObjEntity(Class) . |
ObjEntity |
lookupObjEntity(Object object)
Deprecated. |
Procedure |
lookupProcedure(Query q)
Deprecated. since 3.2. Use q.getMetaData(resolver).getProcedure() |
Procedure |
lookupProcedure(String procedureName)
Deprecated. since 3.2 use getProcedure(String) . |
Query |
lookupQuery(String name)
Deprecated. since 3.2 use getQuery(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)
Sets an optional EntityListenerFactory that should be used to
create entity listeners. |
void |
setIndexedByClass(boolean b)
Deprecated. since 3.2. There's no replacement. This property is meaningless. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.commons.logging.Log logger
@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 EntityListenerFactory entityListenerFactory
Constructor Detail |
---|
public EntityResolver()
public EntityResolver(Collection<DataMap> dataMaps)
Method Detail |
---|
public void applyDBLayerDefaults()
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<Query> 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 procedureName)
MappingNamespace
getProcedure
in interface MappingNamespace
public Query getQuery(String name)
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 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 DataMap getDataMap(String mapName)
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 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)
.
@Deprecated public Query lookupQuery(String name)
getQuery(String)
.
public void removeDataMap(DataMap map)
@Deprecated public boolean isIndexedByClass()
public void setIndexedByClass(boolean b)
public ClassDescriptorMap getClassDescriptorMap()
ClassDescriptor
instances for all entities.
public void setEntityListenerFactory(EntityListenerFactory entityListenerFactory)
EntityListenerFactory
that should be used to
create entity listeners. Note that changing the factory does not affect
already created listeners. So refresh the existing listners, call
"setCallbackRegistry(null)" after setting the listener.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |