Package org.apache.cayenne.reflect
Class BaseToManyProperty
- java.lang.Object
-
- org.apache.cayenne.reflect.BaseProperty
-
- org.apache.cayenne.reflect.BaseArcProperty
-
- org.apache.cayenne.reflect.BaseToManyProperty
-
- All Implemented Interfaces:
ArcProperty
,PropertyDescriptor
,ToManyProperty
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, reverseDbPath, targetDescriptor
-
Fields inherited from class org.apache.cayenne.reflect.BaseProperty
accessor, owner
-
-
Constructor Summary
Constructors Constructor Description BaseToManyProperty(ClassDescriptor owner, ClassDescriptor targetDescriptor, Accessor accessor, String reverseName)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addTarget(Object source, Object target, boolean setReverse)
void
addTargetDirectly(Object source, Object target)
Adds value to collection, without triggering changing events This method is mostly for internal useprotected 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)
void
removeTargetDirectly(Object source, Object target)
Removes value from collection, without triggering changing events This method is mostly for internal useboolean
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, getComplimentaryReverseDbRelationshipPath, 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, getComplimentaryReverseDbRelationshipPath, getRelationship, getTargetDescriptor, invalidate, isFault
-
Methods inherited from interface org.apache.cayenne.reflect.PropertyDescriptor
equals, 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:PropertyDescriptor
Returns a property value, inflating unresolved object if need.- Specified by:
readProperty
in interfacePropertyDescriptor
- Overrides:
readProperty
in classBaseProperty
- 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 interfacePropertyDescriptor
- Overrides:
writePropertyDirectly
in classBaseProperty
- Throws:
PropertyException
-
addTarget
public void addTarget(Object source, Object target, boolean setReverse)
- Specified by:
addTarget
in interfaceToManyProperty
-
addTargetDirectly
public void addTargetDirectly(Object source, Object target) throws PropertyException
Description copied from interface:ToManyProperty
Adds value to collection, without triggering changing events This method is mostly for internal use- Specified by:
addTargetDirectly
in interfaceToManyProperty
- Throws:
PropertyException
-
removeTargetDirectly
public void removeTargetDirectly(Object source, Object target) throws PropertyException
Description copied from interface:ToManyProperty
Removes value from collection, without triggering changing events This method is mostly for internal use- Specified by:
removeTargetDirectly
in interfaceToManyProperty
- Throws:
PropertyException
-
removeTarget
public void removeTarget(Object source, Object target, boolean setReverse)
- Specified by:
removeTarget
in interfaceToManyProperty
-
visit
public boolean visit(PropertyVisitor visitor)
Description copied from interface:PropertyDescriptor
A visitor accept method.- Specified by:
visit
in interfacePropertyDescriptor
- Specified by:
visit
in classBaseArcProperty
- 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 interfacePropertyDescriptor
- Overrides:
injectValueHolder
in classBaseProperty
- 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
-
-