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.
 ObjEntity getEntity()
          Returns an ObjEntity associated with this descriptor.
 Iterator getIdProperties()
          Returns an iterator over the properties mapped to id columns.
 Class getObjectClass()
          Returns a class mapped by this descriptor.
 Iterator 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 decsriptors. 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 getProperties()
Deprecated. since 3.0. Use visitProperties(PropertyVisitor) method instead.

Returns an Iterator over descriptor properties.


getIdProperties

Iterator getIdProperties()
Returns an iterator over the properties mapped to id columns.

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.



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