org.apache.cayenne.reflect
Class BaseToManyProperty

java.lang.Object
  extended by org.apache.cayenne.reflect.BaseProperty
      extended by org.apache.cayenne.reflect.BaseArcProperty
          extended by org.apache.cayenne.reflect.BaseToManyProperty
All Implemented Interfaces:
ArcProperty, Property, ToManyProperty
Direct Known Subclasses:
ListProperty

public abstract class BaseToManyProperty
extends BaseArcProperty
implements ToManyProperty

A generic superclass of CollectionProperty implementations.

Since:
1.2

Field Summary
 
Fields inherited from class org.apache.cayenne.reflect.BaseArcProperty
complimentaryReverseArcName, relationship, targetDescriptor
 
Fields inherited from class org.apache.cayenne.reflect.BaseProperty
accessor, owner
 
Constructor Summary
BaseToManyProperty(ClassDescriptor owner, ClassDescriptor targetDescriptor, Accessor accessor, String reverseName)
           
 
Method Summary
 void addTarget(Object source, Object target, boolean setReverse)
           
protected abstract  ValueHolder createCollectionValueHolder(Object object)
          Creates a Collection for an object.
protected  ValueHolder ensureCollectionValueHolderSet(Object object)
          Checks that an object's List field described by this property is set, injecting a List if needed.
 void injectValueHolder(Object object)
          Injects a List in the object if it hasn't been done yet.
 Object readProperty(Object object)
          Returns a property value, inflating unresolved object if need.
 void removeTarget(Object source, Object target, boolean setReverse)
           
 boolean visit(PropertyVisitor visitor)
          A visitor accept method.
 void writePropertyDirectly(Object object, Object oldValue, Object newValue)
          Wraps list in a value holder that performs lazy faulting.
 
Methods inherited from class org.apache.cayenne.reflect.BaseArcProperty
getComplimentaryReverseArc, getRelationship, getTargetDescriptor, isFault, setReverse
 
Methods inherited from class org.apache.cayenne.reflect.BaseProperty
getName, readPropertyDirectly, toString, writeProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.cayenne.reflect.ArcProperty
getComplimentaryReverseArc, getRelationship, getTargetDescriptor, invalidate, isFault
 
Methods inherited from interface org.apache.cayenne.reflect.Property
getName, readPropertyDirectly, writeProperty
 

Constructor Detail

BaseToManyProperty

public BaseToManyProperty(ClassDescriptor owner,
                          ClassDescriptor targetDescriptor,
                          Accessor accessor,
                          String reverseName)
Method Detail

readProperty

public Object readProperty(Object object)
                    throws PropertyException
Description copied from interface: Property
Returns a property value, inflating unresolved object if need.

Specified by:
readProperty in interface Property
Overrides:
readProperty in class BaseProperty
Throws:
PropertyException

writePropertyDirectly

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

Specified by:
writePropertyDirectly in interface Property
Overrides:
writePropertyDirectly in class BaseProperty
Throws:
PropertyException

addTarget

public void addTarget(Object source,
                      Object target,
                      boolean setReverse)
Specified by:
addTarget in interface ToManyProperty

removeTarget

public void removeTarget(Object source,
                         Object target,
                         boolean setReverse)
Specified by:
removeTarget in interface ToManyProperty

visit

public boolean visit(PropertyVisitor visitor)
Description copied from interface: Property
A visitor accept method.

Specified by:
visit in interface Property
Specified by:
visit in class BaseArcProperty
Returns:
a status returned by the corresponding callback method of the visitor. It serves as an indication of whether peer properties processing is still needed.

injectValueHolder

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

Specified by:
injectValueHolder in interface Property
Overrides:
injectValueHolder in class BaseProperty
Throws:
PropertyException

ensureCollectionValueHolderSet

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

Throws:
PropertyException

createCollectionValueHolder

protected abstract ValueHolder createCollectionValueHolder(Object object)
                                                    throws PropertyException
Creates a Collection for an object.

Throws:
PropertyException


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