|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.triactive.jdo.sco.Set
A set object which is backed "directly" by the database. SCO fields declared as type java.util.Collection or java.util.Set are populated with objects of this type whenever the field is actively being managed by the state manager.
This class differs from HashSet
primarily in
the fact that the contents of the set are not mirrored in memory.
Operations on the set "pass through" directly to the database.
An instance of this class "disconnects" from it backing storage whenever
unsetOwner()
is called.
This occurs automatically in a variety of scenarios, such as when the object
is cloned or when its owning object (the one whose Set field refers to it)
transitions to a transient state.
When a disconnect occurs, the object switches to being backed by a normal
in-memory HashSet and subsequently behaves like a normal HashSet.
If the disconnect occurs during a transaction the contents of the set are
fully loaded from the database.
Subsequent changes to the set affect only the in-memory copy.
Once disconnected from its owner, an instance is never reconnected.
Constructor Summary | |
|
Set(StateManager ownerSM,
java.lang.String fieldName)
|
(package private) |
Set(StateManager ownerSM,
java.lang.String fieldName,
boolean allowNulls,
SetStore setStore)
|
|
Set(StateManager ownerSM,
java.lang.String fieldName,
java.lang.Class elementType,
boolean allowNulls)
|
Method Summary | |
boolean |
add(java.lang.Object element)
|
boolean |
addAll(java.util.Collection c)
|
void |
applyUpdates()
Applies any pending updates for this object to the data store. |
void |
clear()
|
java.lang.Object |
clone()
Creates and returns a copy of this object. |
boolean |
contains(java.lang.Object element)
|
boolean |
containsAll(java.util.Collection c)
|
boolean |
equals(java.lang.Object o)
|
java.lang.String |
getFieldName()
Returns the field name. |
java.lang.Object |
getOwner()
Returns the owner object of the SCO instance. |
int |
hashCode()
|
boolean |
isEmpty()
|
java.util.Iterator |
iterator()
|
void |
makeDirty()
Marks object dirty. |
QueryStatement |
newQueryStatement()
Returns a prototypical query statement over the underlying collection. |
QueryStatement |
newQueryStatement(java.lang.Class candidateClass)
Returns a prototypical query statement over the underlying collection, pre-filtered to include only objects of the specified class. |
Query.ResultObjectFactory |
newResultObjectFactory(QueryStatement stmt)
Returns a suitable query result factory for results produced by the specified query. |
boolean |
remove(java.lang.Object element)
|
boolean |
removeAll(java.util.Collection c)
|
boolean |
retainAll(java.util.Collection c)
|
void |
setValueFrom(java.lang.Object o)
Assigns the value of this second-class object from an existing object of the same or compatible type. |
int |
size()
|
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] a)
|
java.lang.String |
toString()
|
void |
unsetOwner()
Nullifies references to the owner Object and Field. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Set(StateManager ownerSM, java.lang.String fieldName)
public Set(StateManager ownerSM, java.lang.String fieldName, java.lang.Class elementType, boolean allowNulls)
Set(StateManager ownerSM, java.lang.String fieldName, boolean allowNulls, SetStore setStore)
Method Detail |
public void setValueFrom(java.lang.Object o)
SCO
setValueFrom
in interface SCO
o
- the object from which to copy the value.public java.lang.String getFieldName()
SCO
getFieldName
in interface SCO
public java.lang.Object getOwner()
SCO
getOwner
in interface SCO
public void unsetOwner()
SCO
unsetOwner
in interface SCO
public void applyUpdates()
SCO
applyUpdates
in interface SCO
public void makeDirty()
SCO
makeDirty
in interface SCO
public QueryStatement newQueryStatement()
Queryable
The returned query statement selects all applicable rows from the relevant base table(s) and the column that represents the element or element ID. The statement can then be modified to join additional tables, select more columns, add WHERE conditions, etc.
newQueryStatement
in interface Queryable
public QueryStatement newQueryStatement(java.lang.Class candidateClass)
Queryable
newQueryStatement
in interface Queryable
Queryable.newQueryStatement()
public Query.ResultObjectFactory newResultObjectFactory(QueryStatement stmt)
Queryable
The stmt argument must have been obtained by a previous call to newQueryStatement() on the same Queryable.
newResultObjectFactory
in interface Queryable
public java.lang.Object clone()
Mutable second-class Objects are required to provide a public clone method in order to allow for copying PersistenceCapable objects. In contrast to Object.clone(), this method must not throw a CloneNotSupportedException.
public boolean equals(java.lang.Object o)
equals
in interface java.util.Set
public int hashCode()
hashCode
in interface java.util.Set
public java.util.Iterator iterator()
iterator
in interface java.util.Set
public int size()
size
in interface java.util.Set
public boolean isEmpty()
isEmpty
in interface java.util.Set
public boolean contains(java.lang.Object element)
contains
in interface java.util.Set
public boolean add(java.lang.Object element)
add
in interface java.util.Set
public boolean remove(java.lang.Object element)
remove
in interface java.util.Set
public void clear()
clear
in interface java.util.Set
public boolean addAll(java.util.Collection c)
addAll
in interface java.util.Set
public boolean containsAll(java.util.Collection c)
containsAll
in interface java.util.Set
public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Set
public boolean retainAll(java.util.Collection c)
retainAll
in interface java.util.Set
public java.lang.Object[] toArray()
toArray
in interface java.util.Set
public java.lang.Object[] toArray(java.lang.Object[] a)
toArray
in interface java.util.Set
public java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |