Package org.apache.cayenne.reflect
Class LazyClassDescriptorDecorator
java.lang.Object
org.apache.cayenne.reflect.LazyClassDescriptorDecorator
- All Implemented Interfaces:
- ClassDescriptor
public class LazyClassDescriptorDecorator extends Object implements ClassDescriptor
A ClassDescriptor wrapper that compiles decorated descriptor lazily on first access.
- Since:
- 3.0
- 
Field SummaryFields Modifier and Type Field Description protected ClassDescriptordescriptorprotected ClassDescriptorMapdescriptorMapprotected StringentityName
- 
Constructor SummaryConstructors Constructor Description LazyClassDescriptorDecorator(ClassDescriptorMap descriptorMap, String entityName)
- 
Method SummaryModifier and Type Method Description protected voidcheckDescriptorInitialized()Checks whether decorated descriptor is initialized, and if not, creates it using parentClassDescriptorMap.ObjectcreateObject()Creates a new instance of a class described by this object.Map<String,DbEntity>getAdditionalDbEntities()Returns information about additional db entities that is used for this ObjEntity (i.e.PropertyDescriptorgetDeclaredProperty(String propertyName)Returns a Java Bean property descriptor matching property name or null if no such property is found.ClassDescriptorgetDescriptor()Returns underlying descriptor used to delegate all processing, resolving it if needed.Collection<ObjAttribute>getDiscriminatorColumns()Returns a collection of ObjAttribute for the described class, its superclasses and subclasses, that participate in inheritance qualifier.ObjEntitygetEntity()Returns an ObjEntity associated with this descriptor.EntityInheritanceTreegetEntityInheritanceTree()ExpressiongetEntityQualifier()Returns entity qualifier as a Cayenne expression that includes qualifiers for this entity and all subentities.Collection<AttributeProperty>getIdProperties()Returns a collection of the properties mapped to id columns.Collection<ArcProperty>getMapArcProperties()Returns a collection over the arc properties whose reverse arcs are to-many maps.Class<?>getObjectClass()Returns a class mapped by this descriptor.PropertyDescriptorgetProperty(String propertyName)Returns a property descriptor matching property name, or null if no such property is found.Collection<DbEntity>getRootDbEntities()Returns a collection of DbEntities that are the root tables for this descriptor's ObjEntity.ClassDescriptorgetSubclassDescriptor(Class<?> objectClass)Returns the most "specialized" descriptor for a given class.ClassDescriptorgetSuperclassDescriptor()Returns a descriptor of the mapped superclass or null if the descriptor's entity sits at the top of inheritance hierarchy or no inheritance is mapped.booleanhasSubclasses()Returns whether this class has persistent subclasses.voidinjectValueHolders(Object object)Prepares object properties for access.booleanisFault(Object object)Returns true if an object is not fully resolved.voidshallowMerge(Object from, Object to)Merges object properties from one object to another, avoiding traversal of the ArcProperties.StringtoString()booleanvisitAllProperties(PropertyVisitor visitor)Passes the visitor to the properties "visit" method for a combination of all properties, including properties declared in this descriptor, its super descriptors, and all subdescriptors.booleanvisitDeclaredProperties(PropertyVisitor visitor)Passes the visitor to the properties "visit" method for all properties declared in this descriptor.booleanvisitProperties(PropertyVisitor visitor)Passes the visitor to the properties "visit" method for all properties declared in this descriptor and all its super-decsriptors.
- 
Field Details- 
descriptor
- 
descriptorMap
- 
entityName
 
- 
- 
Constructor Details- 
LazyClassDescriptorDecorator
 
- 
- 
Method Details- 
toString
- 
checkDescriptorInitializedprotected void checkDescriptorInitialized()Checks whether decorated descriptor is initialized, and if not, creates it using parentClassDescriptorMap.
- 
getDescriptorReturns underlying descriptor used to delegate all processing, resolving it if needed.
- 
createObjectDescription copied from interface:ClassDescriptorCreates a new instance of a class described by this object.- Specified by:
- createObjectin interface- ClassDescriptor
 
- 
getDeclaredPropertyDescription copied from interface:ClassDescriptorReturns a Java Bean property descriptor matching property name or null if no such property is found. Lookup DOES NOT including properties from the superclass descriptors. Returned property can be any one ofAttributeProperty,ToManyProperty,ToOneProperty.- Specified by:
- getDeclaredPropertyin interface- ClassDescriptor
 
- 
getEntityDescription copied from interface:ClassDescriptorReturns an ObjEntity associated with this descriptor.- Specified by:
- getEntityin interface- ClassDescriptor
 
- 
getRootDbEntitiesDescription copied from interface:ClassDescriptorReturns a collection of DbEntities that are the root tables for this descriptor's ObjEntity. Usually such collection would contain only one entity, however in cases involving subclass horizontal inheritance, it will be more than one, and in cases of abstract entities with no subclasses, the collection will be empty.- Specified by:
- getRootDbEntitiesin interface- ClassDescriptor
 
- 
getAdditionalDbEntitiesDescription copied from interface:ClassDescriptorReturns information about additional db entities that is used for this ObjEntity (i.e. for flattened attributes).Keys are full paths for corresponding flattened attributes. - Specified by:
- getAdditionalDbEntitiesin interface- ClassDescriptor
- Returns:
- information about additional db entities
 
- 
getEntityInheritanceTree- Specified by:
- getEntityInheritanceTreein interface- ClassDescriptor
 
- 
hasSubclassespublic boolean hasSubclasses()Description copied from interface:ClassDescriptorReturns whether this class has persistent subclasses.- Specified by:
- hasSubclassesin interface- ClassDescriptor
 
- 
getObjectClassDescription copied from interface:ClassDescriptorReturns a class mapped by this descriptor.- Specified by:
- getObjectClassin interface- ClassDescriptor
 
- 
getIdPropertiesDescription copied from interface:ClassDescriptorReturns a collection of the properties mapped to id columns.- Specified by:
- getIdPropertiesin interface- ClassDescriptor
 
- 
getDiscriminatorColumnsDescription copied from interface:ClassDescriptorReturns a collection of ObjAttribute for the described class, its superclasses and subclasses, that participate in inheritance qualifier. If a discriminator expression specifies a DbAttribute instead of an ObjAttribute, a synthetic ObjAttribute is created and returned.- Specified by:
- getDiscriminatorColumnsin interface- ClassDescriptor
 
- 
getEntityQualifierDescription copied from interface:ClassDescriptorReturns entity qualifier as a Cayenne expression that includes qualifiers for this entity and all subentities.- Specified by:
- getEntityQualifierin interface- ClassDescriptor
 
- 
getMapArcPropertiesDescription copied from interface:ClassDescriptorReturns a collection over the arc properties whose reverse arcs are to-many maps. I.e. for each ArcProperty in returned collection, the following is true:arc.getComplimentaryReverseArc() instanceof ToManyMapProperty - Specified by:
- getMapArcPropertiesin interface- ClassDescriptor
 
- 
getPropertyDescription copied from interface:ClassDescriptorReturns a property descriptor matching property name, or null if no such property is found. Lookup includes properties from this descriptor and all its superclass descriptors. Returned property can be any one ofAttributeProperty,ToManyProperty,ToOneProperty.- Specified by:
- getPropertyin interface- ClassDescriptor
 
- 
getSubclassDescriptorDescription copied from interface:ClassDescriptorReturns the most "specialized" descriptor for a given class. This method assumes that the following is true:this.getObjectClass().isAssignableFrom(objectClass) - Specified by:
- getSubclassDescriptorin interface- ClassDescriptor
 
- 
getSuperclassDescriptorDescription copied from interface:ClassDescriptorReturns a descriptor of the mapped superclass or null if the descriptor's entity sits at the top of inheritance hierarchy or no inheritance is mapped.- Specified by:
- getSuperclassDescriptorin interface- ClassDescriptor
 
- 
injectValueHoldersDescription copied from interface:ClassDescriptorPrepares object properties for access. This may include injection of value holders into the object and such.- Specified by:
- injectValueHoldersin interface- ClassDescriptor
- Throws:
- PropertyException
 
- 
isFaultDescription copied from interface:ClassDescriptorReturns true if an object is not fully resolved.- Specified by:
- isFaultin interface- ClassDescriptor
 
- 
shallowMergeDescription copied from interface:ClassDescriptorMerges object properties from one object to another, avoiding traversal of the ArcProperties.- Specified by:
- shallowMergein interface- ClassDescriptor
- Throws:
- PropertyException
 
- 
visitDeclaredPropertiesDescription copied from interface:ClassDescriptorPasses the visitor to the properties "visit" method for all properties declared in this descriptor. This property set excludes inherited properties, even those that got overridden in this subclass. Walkthrough is terminated in case one of the properties returns false. Returns true if all visited properties returned true, false - if one property returned false.- Specified by:
- visitDeclaredPropertiesin interface- ClassDescriptor
 
- 
visitPropertiesDescription copied from interface:ClassDescriptorPasses the visitor to the properties "visit" method for all properties declared in this descriptor and all its super-decsriptors. Properties that are overridden in subdescriptors will include overridden information. Walkthrough is terminated in case one of the properties returns false. Returns true if all visited properties returned true, false - if one property returned false.- Specified by:
- visitPropertiesin interface- ClassDescriptor
 
- 
visitAllPropertiesDescription copied from interface:ClassDescriptorPasses the visitor to the properties "visit" method for a combination of all properties, including properties declared in this descriptor, its super descriptors, and all subdescriptors. Walkthrough is terminated in case one of the properties returns false. Returns true if all visited properties returned true, false - if one property returned false.- Specified by:
- visitAllPropertiesin interface- ClassDescriptor
 
 
-