Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne
Interface ValueHolder

All Superinterfaces:
  java.io.Serializable

All Known Implementing Classes:
  IndexPropertyList, PersistentObjectHolder, PersistentObjectList, PersistentObjectMap, PersistentObjectSet, ToManyList

    public interface ValueHolder

extends java.io.Serializable

Provides a level of indirection for property value access, most often used for deferred faulting of to-one relationships. A ValueHolder abstracts how a property value is obtained (fetched from DB, etc.), thus simplifying design of an object that uses it.

Here is an example of a bean property implemented using ValueHolder:

     protected ValueHolder someProperty;

     public SomeClass getSomeProperty() {
         return (SomeClass) somePropertyHolder.getValue(SomeClass.class);
     }

     public void setSomeProperty(SomeClass newValue) {
         somePropertyHolder.setValue(SomeClass.class, newValue);
     }

Since:
  1.2

Method Summary
`java.lang.Object` | `getValue()` Returns an object stored by this ValueHolder.
`java.lang.Object` | `getValueDirectly()` Retrieves ValueHolder value without triggering fault resolution.
`void` | `invalidate()` Turns a ValueHolder into a fault.
`boolean` | `isFault()` Returns true if the internal value is not yet resolved.
`java.lang.Object` | `setValue(java.lang.Object value)` Sets an object stored by this ValueHolder.
`java.lang.Object` | `setValueDirectly(java.lang.Object value)` Sets ValueHolder vaue without triggering fault resolution.

Method Detail

### getValue

    java.lang.Object getValue()
                              throws CayenneRuntimeException

  Returns an object stored by this ValueHolder.

  Throws:
    `CayenneRuntimeException`

### getValueDirectly

    java.lang.Object getValueDirectly()
                                      throws CayenneRuntimeException

  Retrieves ValueHolder value without triggering fault resolution.

  Throws:
    `CayenneRuntimeException`

### setValue

    java.lang.Object setValue(java.lang.Object value)
                              throws CayenneRuntimeException

  Sets an object stored by this ValueHolder.

  Parameters:
    `value` - a new value of the ValueHolder.
  Returns:
    a previous value saved in the ValueHolder.
  Throws:
    `CayenneRuntimeException`

### setValueDirectly

    java.lang.Object setValueDirectly(java.lang.Object value)
                                      throws CayenneRuntimeException

  Sets ValueHolder vaue without triggering fault resolution.

  Throws:
    `CayenneRuntimeException`

### isFault

    boolean isFault()

  Returns true if the internal value is not yet resolved.

### invalidate

    void invalidate()

  Turns a ValueHolder into a fault.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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