org.datanucleus.sco
Interface SCO

All Known Subinterfaces:
SCOCollection, SCOContainer, SCOList, SCOMap
All Known Implementing Classes:
ArrayList, ArrayList, BitSet, Collection, Collection, Date, GregorianCalendar, HashMap, HashMap, HashSet, HashSet, Hashtable, Hashtable, LinkedHashMap, LinkedHashMap, LinkedHashSet, LinkedHashSet, LinkedList, LinkedList, List, List, Map, Map, Point, PriorityQueue, PriorityQueue, Properties, Properties, Queue, Queue, Set, Set, SortedMap, SortedMap, SortedSet, SortedSet, SqlDate, SqlTime, SqlTimestamp, Stack, Stack, TreeMap, TreeMap, TreeSet, TreeSet, Vector, Vector

public interface SCO

Representation of a wrapper/proxy for a mutable SCO type supported. An implementation of this interface must have a constructor with the arguments StateManager ownerSM, String fieldName. The constructor must be capable of taking nulls for these arguments to create a non-managed wrapper which effectively just acts like an unwrapped object.


Method Summary
 void attachCopy(java.lang.Object value)
          Method to return an attached copy of this object.
 java.lang.Object clone()
          Mutable second class objects are required to provide a public clone() method so that copying of persistable objects can take place.
 java.lang.Object detachCopy(FetchPlanState state)
          Method to return a detached copy of this object.
 java.lang.String getFieldName()
          Accessor for the field name.
 java.lang.Object getOwner()
          Accessor for the owner object of the SCO instance.
 java.lang.Object getValue()
          Method to return the value of the unwrapped type.
 void initialise()
          Method to initialise the SCO for use.
 void initialise(java.lang.Object value, boolean forInsert, boolean forUpdate)
          Method to initialise the SCO for use using an existing object of the same or compatible type.
 void unsetOwner()
          Nullifies references to the owner Object and field.
 

Method Detail

initialise

void initialise(java.lang.Object value,
                boolean forInsert,
                boolean forUpdate)
                throws java.lang.ClassCastException
Method to initialise the SCO for use using an existing object of the same or compatible type.

Parameters:
value - the object from which to copy the value.
forInsert - Whether the object needs inserting in the datastore with this value
forUpdate - Whether the object needs updating in the datastore with this value
Throws:
java.lang.ClassCastException - Thrown if the given object is not of a type that's compatible with this second-class wrapper object.

initialise

void initialise()
Method to initialise the SCO for use. This can be utilised to perform any eager loading of information from the datastore.


getFieldName

java.lang.String getFieldName()
Accessor for the field name.

Returns:
field name, or null if no longer associated with an object

getOwner

java.lang.Object getOwner()
Accessor for the owner object of the SCO instance. Is typically a persistable object.

Returns:
owner object, or null if no longer associated with an object

unsetOwner

void unsetOwner()
Nullifies references to the owner Object and field. Thereafter the SCO is no longer associated with the owner and thus should not issue any request to the datastore.


getValue

java.lang.Object getValue()
Method to return the value of the unwrapped type.

Returns:
The value that is wrapped by this object.

clone

java.lang.Object clone()
Mutable second class objects are required to provide a public clone() method so that copying of persistable objects can take place. This mustn't throw a CloneNotSupportedException.

Returns:
A clone of the object

detachCopy

java.lang.Object detachCopy(FetchPlanState state)
Method to return a detached copy of this object. Detaches all components of this object that are also PersistenceCapable.

Parameters:
state - State of the detachment process
Returns:
The detached copy

attachCopy

void attachCopy(java.lang.Object value)
Method to return an attached copy of this object. Attaches all components of this object that are also persistable.

Parameters:
value - The object value from the detached instance


Copyright © 2010. All Rights Reserved.