Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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 Summary
`protected ClassDescriptor` | `descriptor`
`protected ClassDescriptorMap` | `descriptorMap`
`protected String` | `entityName`

Constructor Summary
`LazyClassDescriptorDecorator(ClassDescriptorMap descriptorMap, String entityName)`

Method Summary
`protected void` | `checkDescriptorInitialized()` Checks whether decorated descriptor is initialized, and if not, creates it using parent `ClassDescriptorMap`.
`Object` | `createObject()` Creates a new instance of a class described by this object.
`Property` | `getDeclaredProperty(String propertyName)` Returns a Java Bean property descriptor matching property name or null if no such property is found.
`ClassDescriptor` | `getDescriptor()` Returns underlying descriptor used to delegate all processing, resolving it if needed.
`Iterator<ObjAttribute>` | `getDiscriminatorColumns()` Returns a collection of ObjAttribute for the described class, its superclasses and subclasses, that participate in inheritance qualifier.
`ObjEntity` | `getEntity()` Returns an ObjEntity associated with this descriptor.
`EntityInheritanceTree` | `getEntityInheritanceTree()`
`Expression` | `getEntityQualifier()` Returns entity qualifier as a Cayenne expression that includes qualifiers for this entity and all subentities.
`Iterator<Property>` | `getIdProperties()` Returns an iterator over the properties mapped to id columns.
`Iterator<ArcProperty>` | `getMapArcProperties()` Returns an iterator over the arc properties whose reverse arcs are to-many maps.
`Class<?>` | `getObjectClass()` Returns a class mapped by this descriptor.
`Iterator<Property>` | `getProperties()` Deprecated. since 3.0. Use `visitProperties(PropertyVisitor)` method instead.
`Property` | `getProperty(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.
`ClassDescriptor` | `getSubclassDescriptor(Class<?> objectClass)` Returns the most "specialized" descriptor for a given class.
`ClassDescriptor` | `getSuperclassDescriptor()` 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.
`void` | `injectValueHolders(Object object)` Prepares object properties for access.
`boolean` | `isFault(Object object)` Returns true if an object is not fully resolved.
`void` | `shallowMerge(Object from, Object to)` Merges object properties from one object to another, avoiding traversal of the ArcProperties.
`String` | `toString()`
`boolean` | `visitAllProperties(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.
`boolean` | `visitDeclaredProperties(PropertyVisitor visitor)` Passes the visitor to the properties "visit" method for all properties declared in this descriptor.
`boolean` | `visitProperties(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, wait`

Field Detail

### descriptor

    protected ClassDescriptor descriptor

### descriptorMap

    protected ClassDescriptorMap descriptorMap

### entityName

    protected String entityName

Constructor Detail

### LazyClassDescriptorDecorator

    public LazyClassDescriptorDecorator(ClassDescriptorMap descriptorMap,
                                        String entityName)

Method Detail

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### checkDescriptorInitialized

    protected void checkDescriptorInitialized()

  Checks whether decorated descriptor is initialized, and if not, creates it using parent `ClassDescriptorMap`.

### getDescriptor

    public ClassDescriptor getDescriptor()

  Returns underlying descriptor used to delegate all processing, resolving it if needed.

### createObject

    public Object createObject()

  Description copied from interface: `ClassDescriptor`
  Creates a new instance of a class described by this object.

  Specified by:
    `createObject` in interface `ClassDescriptor`

### getDeclaredProperty

    public Property getDeclaredProperty(String propertyName)

  Description copied from interface: `ClassDescriptor`
  Returns 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 of `AttributeProperty`, `ToManyProperty`, `ToOneProperty`.

  Specified by:
    `getDeclaredProperty` in interface `ClassDescriptor`

### getEntity

    public ObjEntity getEntity()

  Description copied from interface: `ClassDescriptor`
  Returns an ObjEntity associated with this descriptor.

  Specified by:
    `getEntity` in interface `ClassDescriptor`

### getRootDbEntities

    public Collection<DbEntity> getRootDbEntities()

  Description copied from interface: `ClassDescriptor`
  Returns 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:
    `getRootDbEntities` in interface `ClassDescriptor`

### getEntityInheritanceTree

    public EntityInheritanceTree getEntityInheritanceTree()

  Specified by:
    `getEntityInheritanceTree` in interface `ClassDescriptor`

### getObjectClass

    public Class<?> getObjectClass()

  Description copied from interface: `ClassDescriptor`
  Returns a class mapped by this descriptor.

  Specified by:
    `getObjectClass` in interface `ClassDescriptor`

### getProperties

    public Iterator<Property> getProperties()

  Deprecated. since 3.0. Use `visitProperties(PropertyVisitor)` method instead.

  Description copied from interface: `ClassDescriptor`
  Returns an Iterator over descriptor properties.

  Specified by:
    `getProperties` in interface `ClassDescriptor`

### getIdProperties

    public Iterator<Property> getIdProperties()

  Description copied from interface: `ClassDescriptor`
  Returns an iterator over the properties mapped to id columns.

  Specified by:
    `getIdProperties` in interface `ClassDescriptor`

### getDiscriminatorColumns

    public Iterator<ObjAttribute> getDiscriminatorColumns()

  Description copied from interface: `ClassDescriptor`
  Returns 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:
    `getDiscriminatorColumns` in interface `ClassDescriptor`

### getEntityQualifier

    public Expression getEntityQualifier()

  Description copied from interface: `ClassDescriptor`
  Returns entity qualifier as a Cayenne expression that includes qualifiers for this entity and all subentities.

  Specified by:
    `getEntityQualifier` in interface `ClassDescriptor`

### getMapArcProperties

    public Iterator<ArcProperty> getMapArcProperties()

  Description copied from interface: `ClassDescriptor`
  Returns an iterator over the arc properties whose reverse arcs are to-many maps. I.e. for each ArcProperty in the iterator, the following is true:

       arc.getComplimentaryReverseArc() instanceof ToManyMapProperty

  Specified by:
    `getMapArcProperties` in interface `ClassDescriptor`

### getProperty

    public Property getProperty(String propertyName)

  Description copied from interface: `ClassDescriptor`
  Returns 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 of `AttributeProperty`, `ToManyProperty`, `ToOneProperty`.

  Specified by:
    `getProperty` in interface `ClassDescriptor`

### getSubclassDescriptor

    public ClassDescriptor getSubclassDescriptor(Class<?> objectClass)

  Description copied from interface: `ClassDescriptor`
  Returns the most "specialized" descriptor for a given class. This method assumes that the following is true:

       this.getObjectClass().isAssignableFrom(objectClass)

  Specified by:
    `getSubclassDescriptor` in interface `ClassDescriptor`

### getSuperclassDescriptor

    public ClassDescriptor getSuperclassDescriptor()

  Description copied from interface: `ClassDescriptor`
  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.

  Specified by:
    `getSuperclassDescriptor` in interface `ClassDescriptor`

### injectValueHolders

    public void injectValueHolders(Object object)
                            throws PropertyException

  Description copied from interface: `ClassDescriptor`
  Prepares object properties for access. This may include injection of value holders into the object and such.

  Specified by:
    `injectValueHolders` in interface `ClassDescriptor`
  Throws:
    `PropertyException`

### isFault

    public boolean isFault(Object object)

  Description copied from interface: `ClassDescriptor`
  Returns true if an object is not fully resolved.

  Specified by:
    `isFault` in interface `ClassDescriptor`

### shallowMerge

    public void shallowMerge(Object from,
                             Object to)
                      throws PropertyException

  Description copied from interface: `ClassDescriptor`
  Merges object properties from one object to another, avoiding traversal of the ArcProperties.

  Specified by:
    `shallowMerge` in interface `ClassDescriptor`
  Throws:
    `PropertyException`

### visitDeclaredProperties

    public boolean visitDeclaredProperties(PropertyVisitor visitor)

  Description copied from interface: `ClassDescriptor`
  Passes 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:
    `visitDeclaredProperties` in interface `ClassDescriptor`

### visitProperties

    public boolean visitProperties(PropertyVisitor visitor)

  Description copied from interface: `ClassDescriptor`
  Passes 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:
    `visitProperties` in interface `ClassDescriptor`

### visitAllProperties

    public boolean visitAllProperties(PropertyVisitor visitor)

  Description copied from interface: `ClassDescriptor`
  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. 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:
    `visitAllProperties` in interface `ClassDescriptor`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2009 Apache Cayenne. All Rights Reserved.