org.apache.cayenne.map
Class EntityDescriptor

java.lang.Object
  extended by org.apache.cayenne.property.BaseClassDescriptor
      extended by org.apache.cayenne.map.EntityDescriptor
All Implemented Interfaces:
ClassDescriptor

public class EntityDescriptor
extends BaseClassDescriptor

A ClassDescriptor describing a persistent bean based on ObjEntity.

Since:
1.2
Author:
Andrus Adamchik

Field Summary
protected  boolean dataObject
           
protected  ObjEntity entity
           
 
Fields inherited from class org.apache.cayenne.property.BaseClassDescriptor
declaredProperties, objectClass, persistenceStateProperty, subclassDescriptors, superclassDescriptor, valueHolderProperties
 
Constructor Summary
EntityDescriptor(ObjEntity entity, ClassDescriptor superclassDescriptor)
          Creates and compiles a class descriptor for a given entity.
 
Method Summary
 void compile(EntityResolver resolver)
          Prepares the descriptor.
protected  void compileAttributes(java.util.Map allDescriptors)
          Implements an attributes compilation step.
protected  void compileRelationships(EntityResolver resolver, java.util.Map allDescriptors)
          Implements a relationships compilation step.
protected  void compileSpecialProperties()
          Implements an attributes compilation step.
protected  void compileSubclassMapping(EntityResolver resolver, java.util.Map subclassDescriptors, EntityInheritanceTree treeNode)
           
 ObjEntity getEntity()
          Returns ObjEntity described by this object.
 void removeDeclaredProperty(java.lang.String propertyName)
          Removes declared property.
 void setDeclaredProperty(Property property)
          Registers a property.
 void shallowMerge(java.lang.Object from, java.lang.Object to)
          Copies object properties from one object to another.
 java.lang.String toString()
          Overrides toString method of Object to provide a meaningful description.
 
Methods inherited from class org.apache.cayenne.property.BaseClassDescriptor
createObject, getDeclaredProperty, getObjectClass, getProperties, getProperty, getSubclassDescriptor, getSuperclassDescriptor, injectValueHolders, isFault, isValid, visitProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

entity

protected ObjEntity entity

dataObject

protected boolean dataObject
Constructor Detail

EntityDescriptor

public EntityDescriptor(ObjEntity entity,
                        ClassDescriptor superclassDescriptor)
Creates and compiles a class descriptor for a given entity. A second optional 'superclassDescriptor' parameter should be used if an entity has a super-entity.

Method Detail

shallowMerge

public void shallowMerge(java.lang.Object from,
                         java.lang.Object to)
                  throws PropertyAccessException
Description copied from class: BaseClassDescriptor
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
Overrides:
shallowMerge in class BaseClassDescriptor
Throws:
PropertyAccessException

getEntity

public ObjEntity getEntity()
Returns ObjEntity described by this object.


setDeclaredProperty

public void setDeclaredProperty(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(java.lang.String propertyName)
Removes declared property. This method can be used to customize default ClassDescriptor generated from ObjEntity.


compile

public void compile(EntityResolver resolver)
Prepares the descriptor. A descriptor must be explicitly compiled before it can operate.


compileSubclassMapping

protected void compileSubclassMapping(EntityResolver resolver,
                                      java.util.Map subclassDescriptors,
                                      EntityInheritanceTree treeNode)

compileSpecialProperties

protected void compileSpecialProperties()
Implements an attributes compilation step. Called internally from "compile".


compileAttributes

protected void compileAttributes(java.util.Map allDescriptors)
Implements an attributes compilation step. Called internally from "compile".


compileRelationships

protected void compileRelationships(EntityResolver resolver,
                                    java.util.Map allDescriptors)
Implements a relationships compilation step. Maps each to-one relationship to a ValueHolderProperty and to-many - to CollectionProperty. Called internally from "compile" method.


toString

public java.lang.String toString()
Overrides toString method of Object to provide a meaningful description.

Overrides:
toString in class java.lang.Object


Copyright © 2001-2006 Apache.org All Rights Reserved.