Package org.apache.cayenne.map
Class EntityResolver
java.lang.Object
org.apache.cayenne.map.EntityResolver
- All Implemented Interfaces:
- Serializable,- MappingNamespace
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.
- Since:
- 1.1
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected LifecycleCallbackRegistryprotected ClassDescriptorMapprotected EntitySorterprotected static AtomicLongprotected static final Map<LifecycleEvent,Class<? extends Annotation>> protected static final org.slf4j.Loggerprotected MappingNamespaceprotected Collection<DataMap>protected AdhocObjectFactoryprotected ValueComparisonStrategyFactoryprotected ValueObjectTypeRegistry
- 
Constructor SummaryConstructorsConstructorDescriptionCreates new empty EntityResolver.EntityResolver(Collection<DataMap> dataMaps) Creates new EntityResolver that indexes a collection of DataMaps.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddDataMap(DataMap map) voidUpdates missing mapping artifacts that can be guessed from other mapping information.Returns aLifecycleCallbackRegistryfor handling callbacks.getClassDescriptor(String entityName) Returns ClassDescriptor for the ObjEntity matching the name.Returns an object that compiles and storesClassDescriptorinstances for all entities.getDataMap(String mapName) Returns a DataMap matching the name.Returns an unmodifiable collection of DataMaps.Returns all DbEntities.getDbEntity(String name) Returns DbEntity for a given name, or null if no such DbEntity is found in the MappingNamespace.getEmbeddable(String className) Returns anEmbeddablematching class name or null if such Embeddable is not mapped.getInheritanceTree(String entityName) Returns all ObjEntities in the namespace.getObjEntity(Class<?> entityClass) Looks in the DataMap's that this object was created with for the ObjEntity that maps to the services the specified classgetObjEntity(String name) Returns ObjEntity for a given name, or null if no such ObjEntity is found in the MappingNamespace.getObjEntity(Persistent object) getProcedure(String procedureName) Returns Procedure for a given name, or null if no such Procedure is found in the MappingNamespace.Returns all Procedures in the namespace.getQueryDescriptor(String name) Returns a named query or null if no query exists for a given name.Returns all Queries in the namespace.Returns a named result set mapping.voidRefreshes entity cache to reflect the current state of the DataMaps in the EntityResolver.voidremoveDataMap(DataMap map) voidsetCallbackRegistry(LifecycleCallbackRegistry callbackRegistry) Sets a lifecycle callbacks registry of the EntityResolver.voidsetDataMaps(Collection<DataMap> maps) voidsetEntitySorter(EntitySorter entitySorter) voidsetObjectFactory(AdhocObjectFactory objectFactory) voidsetValueComparisonStrategyFactory(ValueComparisonStrategyFactory valueComparisonStrategyFactory) voidsetValueObjectTypeRegistry(ValueObjectTypeRegistry valueObjectTypeRegistry) 
- 
Field Details- 
loggerprotected static final org.slf4j.Logger logger
- 
incrementer
- 
LIFECYCLE_EVENT_MAP
- 
maps
- 
mappingCache
- 
classDescriptorMap
- 
callbackRegistry
- 
valueObjectTypeRegistry
- 
valueComparisonStrategyFactory- Since:
- 4.2
 
- 
entitySorter- Since:
- 4.2
 
- 
objectFactory- Since:
- 5.0
 
 
- 
- 
Constructor Details- 
EntityResolverpublic EntityResolver()Creates new empty EntityResolver.
- 
EntityResolverCreates new EntityResolver that indexes a collection of DataMaps.
 
- 
- 
Method Details- 
applyDBLayerDefaultspublic void applyDBLayerDefaults()Updates missing mapping artifacts that can be guessed from other mapping information. This implementation creates missing reverse relationships, marking newly created relationships as "runtime".- Since:
- 3.0
 
- 
getCallbackRegistryReturns aLifecycleCallbackRegistryfor handling callbacks. Registry is lazily initialized on first call.- Since:
- 3.0
 
- 
setCallbackRegistrySets a lifecycle callbacks registry of the EntityResolver. Users rarely if ever need to call this method as Cayenne would instantiate a registry itself as needed based on mapped configuration.- Since:
- 3.0
 
- 
getDbEntitiesReturns all DbEntities.- Specified by:
- getDbEntitiesin interface- MappingNamespace
 
- 
getObjEntitiesDescription copied from interface:MappingNamespaceReturns all ObjEntities in the namespace.- Specified by:
- getObjEntitiesin interface- MappingNamespace
 
- 
getEmbeddables- Specified by:
- getEmbeddablesin interface- MappingNamespace
- Since:
- 3.0
 
- 
getResults- Specified by:
- getResultsin interface- MappingNamespace
- Since:
- 4.0
 
- 
getProceduresDescription copied from interface:MappingNamespaceReturns all Procedures in the namespace.- Specified by:
- getProceduresin interface- MappingNamespace
 
- 
getQueryDescriptorsDescription copied from interface:MappingNamespaceReturns all Queries in the namespace.- Specified by:
- getQueryDescriptorsin interface- MappingNamespace
 
- 
getDbEntityDescription copied from interface:MappingNamespaceReturns DbEntity for a given name, or null if no such DbEntity is found in the MappingNamespace.- Specified by:
- getDbEntityin interface- MappingNamespace
 
- 
getObjEntityDescription copied from interface:MappingNamespaceReturns ObjEntity for a given name, or null if no such ObjEntity is found in the MappingNamespace.- Specified by:
- getObjEntityin interface- MappingNamespace
 
- 
getProcedureDescription copied from interface:MappingNamespaceReturns Procedure for a given name, or null if no such Procedure is found in the MappingNamespace.- Specified by:
- getProcedurein interface- MappingNamespace
 
- 
getQueryDescriptorReturns a named query or null if no query exists for a given name.- Specified by:
- getQueryDescriptorin interface- MappingNamespace
 
- 
getEmbeddableDescription copied from interface:MappingNamespaceReturns anEmbeddablematching class name or null if such Embeddable is not mapped.- Specified by:
- getEmbeddablein interface- MappingNamespace
- Since:
- 3.0
 
- 
getResultDescription copied from interface:MappingNamespaceReturns a named result set mapping.- Specified by:
- getResultin interface- MappingNamespace
- Since:
- 3.0
 
- 
getClassDescriptorReturns ClassDescriptor for the ObjEntity matching the name. Returns null if no matching entity exists.- Since:
- 1.2
 
- 
addDataMap
- 
refreshMappingCachepublic void refreshMappingCache()Refreshes entity cache to reflect the current state of the DataMaps in the EntityResolver.- Since:
- 4.0
 
- 
getDataMapReturns a DataMap matching the name.
- 
setDataMaps
- 
getDataMapsReturns an unmodifiable collection of DataMaps.
- 
getInheritanceTree- Specified by:
- getInheritanceTreein interface- MappingNamespace
- Since:
- 4.0
 
- 
getObjEntityLooks in the DataMap's that this object was created with for the ObjEntity that maps to the services the specified class- Specified by:
- getObjEntityin interface- MappingNamespace
- Returns:
- the required ObjEntity or null if there is none that matches the specifier
- Since:
- 4.0
 
- 
getObjEntity- Specified by:
- getObjEntityin interface- MappingNamespace
 
- 
removeDataMap
- 
getClassDescriptorMapReturns an object that compiles and storesClassDescriptorinstances for all entities.- Since:
- 3.0
 
- 
getValueObjectTypeRegistry
- 
setValueObjectTypeRegistry
- 
setValueComparisonStrategyFactorypublic void setValueComparisonStrategyFactory(ValueComparisonStrategyFactory valueComparisonStrategyFactory) - Since:
- 4.2
 
- 
setEntitySorter- Since:
- 4.2
 
- 
getEntitySorter- Since:
- 4.2
 
- 
setObjectFactory- Since:
- 5.0
 
- 
getObjectFactory- Since:
- 5.0
 
 
-