Package org.apache.cayenne.reflect
Class LazyClassDescriptorDecorator
java.lang.Object
org.apache.cayenne.reflect.LazyClassDescriptorDecorator
- All Implemented Interfaces:
ClassDescriptor
A ClassDescriptor wrapper that compiles decorated descriptor lazily on first access.
- Since:
- 3.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ClassDescriptorprotected ClassDescriptorMapprotected String -
Constructor Summary
ConstructorsConstructorDescriptionLazyClassDescriptorDecorator(ClassDescriptorMap descriptorMap, String entityName) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidChecks whether decorated descriptor is initialized, and if not, creates it using parentClassDescriptorMap.Creates a new instance of a class described by this object.Returns information about additional db entities that is used for this ObjEntity (i.e.getDeclaredProperty(String propertyName) Returns a Java Bean property descriptor matching property name or null if no such property is found.Returns underlying descriptor used to delegate all processing, resolving it if needed.Returns a collection of ObjAttribute for the described class, its superclasses and subclasses, that participate in inheritance qualifier.Returns an ObjEntity associated with this descriptor.Returns entity qualifier as a Cayenne expression that includes qualifiers for this entity and all subentities.Returns a collection of the properties mapped to id columns.Returns a collection over the arc properties whose reverse arcs are to-many maps.Class<?>Returns a class mapped by this descriptor.getProperty(String propertyName) Returns a property descriptor matching property name, or null if no such property is found.Returns a collection of DbEntities that are the root tables for this descriptor's ObjEntity.getSubclassDescriptor(String entityName) Returns the most "specialized" descriptor for a given entity name.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.booleanReturns whether this class has persistent subclasses.voidinjectValueHolders(Object object) Prepares object properties for access.booleanReturns 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.toString()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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.cayenne.reflect.ClassDescriptor
getSubclassDescriptor
-
Field Details
-
descriptor
-
descriptorMap
-
entityName
-
-
Constructor Details
-
LazyClassDescriptorDecorator
-
-
Method Details
-
toString
-
checkDescriptorInitialized
protected void checkDescriptorInitialized()Checks whether decorated descriptor is initialized, and if not, creates it using parentClassDescriptorMap. -
getDescriptor
Returns underlying descriptor used to delegate all processing, resolving it if needed. -
createObject
Description copied from interface:ClassDescriptorCreates a new instance of a class described by this object.- Specified by:
createObjectin interfaceClassDescriptor
-
getDeclaredProperty
Description 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 interfaceClassDescriptor
-
getEntity
Description copied from interface:ClassDescriptorReturns an ObjEntity associated with this descriptor.- Specified by:
getEntityin interfaceClassDescriptor
-
getRootDbEntities
Description 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 interfaceClassDescriptor
-
getAdditionalDbEntities
Description 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 interfaceClassDescriptor- Returns:
- information about additional db entities
-
getEntityInheritanceTree
- Specified by:
getEntityInheritanceTreein interfaceClassDescriptor
-
hasSubclasses
public boolean hasSubclasses()Description copied from interface:ClassDescriptorReturns whether this class has persistent subclasses.- Specified by:
hasSubclassesin interfaceClassDescriptor
-
getObjectClass
Description copied from interface:ClassDescriptorReturns a class mapped by this descriptor.- Specified by:
getObjectClassin interfaceClassDescriptor
-
getIdProperties
Description copied from interface:ClassDescriptorReturns a collection of the properties mapped to id columns.- Specified by:
getIdPropertiesin interfaceClassDescriptor
-
getDiscriminatorColumns
Description 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 interfaceClassDescriptor
-
getEntityQualifier
Description copied from interface:ClassDescriptorReturns entity qualifier as a Cayenne expression that includes qualifiers for this entity and all subentities.- Specified by:
getEntityQualifierin interfaceClassDescriptor
-
getMapArcProperties
Description 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 interfaceClassDescriptor
-
getProperty
Description 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 interfaceClassDescriptor
-
getSubclassDescriptor
Description copied from interface:ClassDescriptorReturns the most "specialized" descriptor for a given entity name.- Specified by:
getSubclassDescriptorin interfaceClassDescriptor
-
getSuperclassDescriptor
Description 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 interfaceClassDescriptor
-
injectValueHolders
Description copied from interface:ClassDescriptorPrepares object properties for access. This may include injection of value holders into the object and such.- Specified by:
injectValueHoldersin interfaceClassDescriptor- Throws:
PropertyException
-
isFault
Description copied from interface:ClassDescriptorReturns true if an object is not fully resolved.- Specified by:
isFaultin interfaceClassDescriptor
-
shallowMerge
Description copied from interface:ClassDescriptorMerges object properties from one object to another, avoiding traversal of the ArcProperties.- Specified by:
shallowMergein interfaceClassDescriptor- Throws:
PropertyException
-
visitDeclaredProperties
Description 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 interfaceClassDescriptor
-
visitProperties
Description 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 interfaceClassDescriptor
-
visitAllProperties
Description 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 interfaceClassDescriptor
-