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
Interface ClassDescriptor

All Known Implementing Classes:
  LazyClassDescriptorDecorator, PersistentDescriptor

    public interface ClassDescriptor

A runtime descriptor of an persistent class.

Since:
  1.2
Author:
  Andrus Adamchik

Method Summary
`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)` Returns a property descriptor matching property name, or null if no such property is found.
`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.
`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.

Method Detail

### getEntity

    ObjEntity getEntity()

  Returns an ObjEntity associated with this descriptor.

  Since:
    3.0

### getObjectClass

    Class<?> getObjectClass()

  Returns a class mapped by this descriptor.

### getSuperclassDescriptor

    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.

### getSubclassDescriptor

    ClassDescriptor getSubclassDescriptor(Class<?> objectClass)

  Returns the most "specialized" descriptor for a given class. This method assumes that the following is true:

       this.getObjectClass().isAssignableFrom(objectClass)

### createObject

    Object createObject()

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

### injectValueHolders

    void injectValueHolders(Object object)
                            throws PropertyException

  Prepares object properties for access. This may include injection of value holders into the object and such.

  Throws:
    `PropertyException`

### shallowMerge

    void shallowMerge(Object from,
                      Object to)
                      throws PropertyException

  Merges object properties from one object to another, avoiding traversal of the ArcProperties.

  Throws:
    `PropertyException`

### getProperty

    Property getProperty(String propertyName)

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

### getDeclaredProperty

    Property getDeclaredProperty(String propertyName)

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

### getProperties

    Iterator<Property> getProperties()

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

  Returns an Iterator over descriptor properties.

### getIdProperties

    Iterator<Property> getIdProperties()

  Returns an iterator over the properties mapped to id columns.

  Since:
    3.0

### getDiscriminatorColumns

    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.

  Since:
    3.0

### getEntityQualifier

    Expression getEntityQualifier()

  Returns entity qualifier as a Cayenne expression that includes qualifiers for this entity and all subentities.

  Since:
    3.0

### getMapArcProperties

    Iterator<ArcProperty> getMapArcProperties()

  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

  Since:
    3.0

### visitProperties

    boolean visitProperties(PropertyVisitor visitor)

  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.

### visitDeclaredProperties

    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. Returns true if all visited properties returned true, false - if one property returned false.

  Since:
    3.0

### visitAllProperties

    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. Returns true if all visited properties returned true, false - if one property returned false.

  Since:
    3.0

### isFault

    boolean isFault(Object object)

  Returns true if an object is not fully resolved.

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.