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 PersistentDescriptor

    java.lang.Object
      org.apache.cayenne.reflect.PersistentDescriptor

All Implemented Interfaces:
  ClassDescriptor

    public class PersistentDescriptor

extends Object
implements ClassDescriptor

A default ClassDescriptor implementation for persistent objects.

Since:
  3.0
Author:
  Andrus Adamchik

Field Summary
`protected Collection<DbAttribute>` | `allDiscriminatorColumns`
`protected Collection<Property>` | `declaredIdProperties`
`protected Collection<ArcProperty>` | `declaredMapArcProperties`
`protected Map<String,Property>` | `declaredProperties`
`protected ObjEntity` | `entity`
`protected Expression` | `entityQualifier`
`protected Class<?>` | `objectClass`
`protected Accessor` | `persistenceStateAccessor`
`protected Map<String,ClassDescriptor>` | `subclassDescriptors`
`protected ClassDescriptor` | `superclassDescriptor`

Constructor Summary
`PersistentDescriptor()` Creates a PersistentDescriptor.

Method Summary
`void` | `addDeclaredProperty(Property property)` Registers a property.
`void` | `addSubclassDescriptor(ClassDescriptor subclassDescriptor)`
`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.
`Iterator<DbAttribute>` | `getDiscriminatorColumns()` Returns a collection of DbAttributes for the described class, its superclasses and subclasses, that participate in inheritance qualifier, but are not mapped as object properties.
`ObjEntity` | `getEntity()` Returns an ObjEntity associated with this descriptor.
`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)` Recursively looks up property descriptor in this class descriptor and all superclass descriptors.
`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.
`void` | `injectValueHolders(Object object)` Invokes 'prepareForAccess' of a super descriptor and then invokes 'prepareForAccess' of each declared property.
`boolean` | `isFault(Object object)` Returns true if an object is not fully resolved.
`void` | `removeDeclaredProperty(String propertyName)` Removes declared property.
`void` | `setDiscriminatorColumns(Collection<DbAttribute> columns)`
`void` | `setEntity(ObjEntity entity)`
`void` | `setEntityQualifier(Expression entityQualifier)`
`void` | `setPersistenceStateAccessor(Accessor persistenceStateAccessor)`
`void` | `setSuperclassDescriptor(ClassDescriptor superclassDescriptor)`
`void` | `shallowMerge(Object from, Object to)` Copies object properties from one object to another.
`boolean` | `visitAllProperties(PropertyVisitor visitor)` Passes the visitor to the properties "visit" method for all properties declared in this descriptor, its super and subdescriptors, terminating properties walkthrough in case one of the properties returns false.
`boolean` | `visitDeclaredProperties(PropertyVisitor visitor)` Passes the visitor to the properties "visit" method for all properties declared in this descriptor, terminating properties walkthrough in case one of the properties returns false.
`boolean` | `visitProperties(PropertyVisitor visitor)` Passes the visitor to all properties "visit" method, terminating properties walkthrough in case one of the properties returns false.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### superclassDescriptor

    protected ClassDescriptor superclassDescriptor

### objectClass

    protected Class<?> objectClass

### declaredProperties

    protected Map<String,Property> declaredProperties

### subclassDescriptors

    protected Map<String,ClassDescriptor> subclassDescriptors

### persistenceStateAccessor

    protected Accessor persistenceStateAccessor

### entity

    protected ObjEntity entity

### declaredIdProperties

    protected Collection<Property> declaredIdProperties

### declaredMapArcProperties

    protected Collection<ArcProperty> declaredMapArcProperties

### allDiscriminatorColumns

    protected Collection<DbAttribute> allDiscriminatorColumns

### entityQualifier

    protected Expression entityQualifier

Constructor Detail

### PersistentDescriptor

    public PersistentDescriptor()

  Creates a PersistentDescriptor.

Method Detail

### setDiscriminatorColumns

    public void setDiscriminatorColumns(Collection<DbAttribute> columns)

### addDeclaredProperty

    public void addDeclaredProperty(Property property)

  Registers a property. This method is useful to customize default ClassDescriptor generated from ObjEntity by adding new properties or overriding the standard ones.

### removeDeclaredProperty

    public void removeDeclaredProperty(String propertyName)

  Removes declared property. This method can be used to customize default ClassDescriptor generated from ObjEntity.

### addSubclassDescriptor

    public void addSubclassDescriptor(ClassDescriptor subclassDescriptor)

### getEntity

    public ObjEntity getEntity()

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

  Specified by:
    `getEntity` in interface `ClassDescriptor`

### 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`

### getObjectClass

    public Class<?> getObjectClass()

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

  Specified by:
    `getObjectClass` 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`

### 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`

### getDiscriminatorColumns

    public Iterator<DbAttribute> getDiscriminatorColumns()

  Description copied from interface: `ClassDescriptor`
  Returns a collection of DbAttributes for the described class, its superclasses and subclasses, that participate in inheritance qualifier, but are not mapped as object properties.

  Specified by:
    `getDiscriminatorColumns` 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`

### 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)

  Recursively looks up property descriptor in this class descriptor and all superclass descriptors.

  Specified by:
    `getProperty` 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`

### getSuperclassDescriptor

    public ClassDescriptor getSuperclassDescriptor()

  Returns a descriptor of the mapped superclass or null if the descriptor's entity sits at the top of inheritance hierarchy.

  Specified by:
    `getSuperclassDescriptor` in interface `ClassDescriptor`

### createObject

    public Object createObject()

  Creates a new instance of a class described by this object.

  Specified by:
    `createObject` in interface `ClassDescriptor`

### injectValueHolders

    public void injectValueHolders(Object object)
                            throws PropertyException

  Invokes 'prepareForAccess' of a super descriptor and then invokes 'prepareForAccess' of each declared property.

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

### shallowMerge

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

  Copies object properties from one object to another. Invokes 'shallowCopy' of a super descriptor and then invokes 'shallowCopy' of each declared property.

  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, terminating properties walkthrough 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`
  Since:
    3.0

### visitAllProperties

    public boolean visitAllProperties(PropertyVisitor visitor)

  Description copied from interface: `ClassDescriptor`
  Passes the visitor to the properties "visit" method for all properties declared in this descriptor, its super and subdescriptors, terminating properties walkthrough 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`
  Since:
    3.0

### visitProperties

    public boolean visitProperties(PropertyVisitor visitor)

  Description copied from interface: `ClassDescriptor`
  Passes the visitor to all properties "visit" method, terminating properties walkthrough 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`

### setPersistenceStateAccessor

    public void setPersistenceStateAccessor(Accessor persistenceStateAccessor)

### setEntity

    public void setEntity(ObjEntity entity)

### setSuperclassDescriptor

    public void setSuperclassDescriptor(ClassDescriptor superclassDescriptor)

### 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`

### setEntityQualifier

    public void setEntityQualifier(Expression entityQualifier)

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-2008 Apache Cayenne. All Rights Reserved.