org.apache.cayenne.property
Class AbstractCollectionProperty

java.lang.Object
  extended by org.apache.cayenne.property.SimpleProperty
      extended by org.apache.cayenne.property.AbstractSingleObjectArcProperty
          extended by org.apache.cayenne.property.AbstractCollectionProperty
All Implemented Interfaces:
java.io.Serializable, ArcProperty, CollectionProperty, Property, PropertyAccessor, SingleObjectArcProperty
Direct Known Subclasses:
ListProperty

public abstract class AbstractCollectionProperty
extends AbstractSingleObjectArcProperty
implements CollectionProperty

A generic superclass of CollectionProperty implementations.

Since:
1.2
Author:
Andrus Adamchik
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.cayenne.property.AbstractSingleObjectArcProperty
complimentaryReverseArcName, targetDescriptor
 
Fields inherited from class org.apache.cayenne.property.SimpleProperty
accessor, owner
 
Constructor Summary
AbstractCollectionProperty(ClassDescriptor owner, ClassDescriptor targetDescriptor, PropertyAccessor accessor, java.lang.String reverseName)
           
 
Method Summary
 void addTarget(java.lang.Object source, java.lang.Object target, boolean setReverse)
           
protected abstract  ValueHolder createCollectionValueHolder(java.lang.Object object)
          Creates a Collection for an object.
protected  ValueHolder ensureCollectionValueHolderSet(java.lang.Object object)
          Checks that an object's List field described by this property is set, injecting a List if needed.
 void injectValueHolder(java.lang.Object object)
          Injects a List in the object if it hasn't been done yet.
 java.lang.Object readProperty(java.lang.Object object)
          Returns a property value, resolving object fault if needed.
 void removeTarget(java.lang.Object source, java.lang.Object target, boolean setReverse)
           
 void shallowMerge(java.lang.Object from, java.lang.Object to)
          Copies a property value from one object to another.
 boolean visit(PropertyVisitor visitor)
           
 void writePropertyDirectly(java.lang.Object object, java.lang.Object oldValue, java.lang.Object newValue)
          Wraps list in a value holder that performs lazy faulting.
 
Methods inherited from class org.apache.cayenne.property.AbstractSingleObjectArcProperty
getComplimentaryReverseArc, getTargetDescriptor, isFault, setReverse, setTarget
 
Methods inherited from class org.apache.cayenne.property.SimpleProperty
getName, readPropertyDirectly, writeProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.cayenne.property.ArcProperty
getComplimentaryReverseArc, getTargetDescriptor, isFault
 
Methods inherited from interface org.apache.cayenne.property.Property
writeProperty
 
Methods inherited from interface org.apache.cayenne.property.PropertyAccessor
getName, readPropertyDirectly
 

Constructor Detail

AbstractCollectionProperty

public AbstractCollectionProperty(ClassDescriptor owner,
                                  ClassDescriptor targetDescriptor,
                                  PropertyAccessor accessor,
                                  java.lang.String reverseName)
Method Detail

readProperty

public java.lang.Object readProperty(java.lang.Object object)
                              throws PropertyAccessException
Description copied from interface: Property
Returns a property value, resolving object fault if needed.

Specified by:
readProperty in interface Property
Overrides:
readProperty in class SimpleProperty
Throws:
PropertyAccessException

writePropertyDirectly

public void writePropertyDirectly(java.lang.Object object,
                                  java.lang.Object oldValue,
                                  java.lang.Object newValue)
                           throws PropertyAccessException
Wraps list in a value holder that performs lazy faulting.

Specified by:
writePropertyDirectly in interface PropertyAccessor
Overrides:
writePropertyDirectly in class SimpleProperty
Throws:
PropertyAccessException

addTarget

public void addTarget(java.lang.Object source,
                      java.lang.Object target,
                      boolean setReverse)
Specified by:
addTarget in interface CollectionProperty

removeTarget

public void removeTarget(java.lang.Object source,
                         java.lang.Object target,
                         boolean setReverse)
Specified by:
removeTarget in interface CollectionProperty

visit

public boolean visit(PropertyVisitor visitor)
Specified by:
visit in interface Property
Overrides:
visit in class AbstractSingleObjectArcProperty

shallowMerge

public void shallowMerge(java.lang.Object from,
                         java.lang.Object to)
                  throws PropertyAccessException
Description copied from interface: Property
Copies a property value from one object to another.

Specified by:
shallowMerge in interface Property
Overrides:
shallowMerge in class SimpleProperty
Throws:
PropertyAccessException

injectValueHolder

public void injectValueHolder(java.lang.Object object)
                       throws PropertyAccessException
Injects a List in the object if it hasn't been done yet.

Specified by:
injectValueHolder in interface Property
Overrides:
injectValueHolder in class SimpleProperty
Throws:
PropertyAccessException

ensureCollectionValueHolderSet

protected ValueHolder ensureCollectionValueHolderSet(java.lang.Object object)
                                              throws PropertyAccessException
Checks that an object's List field described by this property is set, injecting a List if needed.

Throws:
PropertyAccessException

createCollectionValueHolder

protected abstract ValueHolder createCollectionValueHolder(java.lang.Object object)
                                                    throws PropertyAccessException
Creates a Collection for an object.

Throws:
PropertyAccessException


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