org.apache.cayenne.property
Class ValueHolderProperty

java.lang.Object
  extended by org.apache.cayenne.property.SimpleProperty
      extended by org.apache.cayenne.property.AbstractSingleObjectArcProperty
          extended by org.apache.cayenne.property.ValueHolderProperty
All Implemented Interfaces:
java.io.Serializable, ArcProperty, Property, PropertyAccessor, SingleObjectArcProperty

public class ValueHolderProperty
extends AbstractSingleObjectArcProperty

Provides access to a property implemented as a ValueHolder Field. This implementation hides the fact of the ValueHolder existence. I.e. it never returns it from 'readPropertyDirectly', returning held value instead.

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
ValueHolderProperty(ClassDescriptor owner, ClassDescriptor targetDescriptor, PropertyAccessor accessor, java.lang.String reverseName)
           
 
Method Summary
protected  ValueHolder createValueHolder(java.lang.Object object)
          Creates a ValueHolder for an object.
protected  ValueHolder ensureValueHolderSet(java.lang.Object object)
          Checks that an object's ValueHolder field described by this property is set, injecting a ValueHolder if needed.
 void injectValueHolder(java.lang.Object object)
          Injects a ValueHolder in the object if it hasn't been done yet.
 boolean isFault(java.lang.Object object)
          Returns true if a property ValueHolder is not initialized or is itself a fault.
 java.lang.Object readProperty(java.lang.Object object)
          Returns a property value, resolving object fault if needed.
 java.lang.Object readPropertyDirectly(java.lang.Object object)
          Returns a property value of an object without disturbing the object fault status.
 void shallowMerge(java.lang.Object from, java.lang.Object to)
          Copies a property value from one object to another.
 void writeProperty(java.lang.Object object, java.lang.Object oldValue, java.lang.Object newValue)
          Sets a property value,resolving object fault if needed.
 void writePropertyDirectly(java.lang.Object object, java.lang.Object oldValue, java.lang.Object newValue)
          Sets a property value of an object without disturbing the object fault status.
 
Methods inherited from class org.apache.cayenne.property.AbstractSingleObjectArcProperty
getComplimentaryReverseArc, getTargetDescriptor, setReverse, setTarget, visit
 
Methods inherited from class org.apache.cayenne.property.SimpleProperty
getName
 
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.PropertyAccessor
getName
 

Constructor Detail

ValueHolderProperty

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

isFault

public boolean isFault(java.lang.Object object)
Returns true if a property ValueHolder is not initialized or is itself a fault.

Specified by:
isFault in interface ArcProperty
Specified by:
isFault in class AbstractSingleObjectArcProperty

readPropertyDirectly

public java.lang.Object readPropertyDirectly(java.lang.Object object)
                                      throws PropertyAccessException
Description copied from interface: PropertyAccessor
Returns a property value of an object without disturbing the object fault status.

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

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
Description copied from interface: PropertyAccessor
Sets a property value of an object without disturbing the object fault status. Old value of the property is specified as a hint.

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

writeProperty

public void writeProperty(java.lang.Object object,
                          java.lang.Object oldValue,
                          java.lang.Object newValue)
                   throws PropertyAccessException
Description copied from interface: Property
Sets a property value,resolving object fault if needed. Old value of the property is specified as a hint.

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

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 ValueHolder in the object if it hasn't been done yet.

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

ensureValueHolderSet

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

Throws:
PropertyAccessException

createValueHolder

protected ValueHolder createValueHolder(java.lang.Object object)
                                 throws PropertyAccessException
Creates a ValueHolder for an object. Default implementation requires that an object implements Persistent interface.

Throws:
PropertyAccessException


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