public class Collection<E> extends AbstractCollection<E> implements SCOCollection<Collection<E>,E>, Cloneable, Serializable
Modifier and Type | Field and Description |
---|---|
protected Collection<E> |
delegate
The internal "delegate".
|
protected AbstractMemberMetaData |
ownerMmd |
protected ObjectProvider |
ownerOP |
Constructor and Description |
---|
Collection(ObjectProvider ownerOP,
AbstractMemberMetaData mmd)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(E element)
Method to add an element to the Collection.
|
boolean |
addAll(Collection c)
Method to add a collection of elements.
|
void |
attachCopy(Collection value)
Method to return an attached copy of the passed (detached) value.
|
void |
clear()
Method to clear the Collection.
|
Object |
clone()
Creates and returns a copy of this object.
|
boolean |
contains(Object element)
Accessor for whether an element is contained in the Collection.
|
boolean |
containsAll(Collection c)
Accessor for whether a collection of elements are contained here.
|
Collection |
detachCopy(FetchPlanState state)
Method to return a detached copy of the container.
|
boolean |
equals(Object o)
Equality operator.
|
void |
forEach(java.util.function.Consumer action) |
String |
getFieldName()
Accessor for the field name.
|
Object |
getOwner()
Accessor for the owner object.
|
Collection<E> |
getValue()
Accessor for the unwrapped value that we are wrapping.
|
int |
hashCode()
Hashcode operator.
|
void |
initialise()
Method to initialise the SCO for use, and allowing the SCO to be loaded from the datastore (when we have a backing store).
|
void |
initialise(Collection c)
Method to initialise the SCO for use with the provided initial value.
|
void |
initialise(Collection<E> newValue,
Object oldValue)
Method to initialise the SCO for use, where replacing an old value with a new value such as when calling a setter field
passing in a new value.
|
boolean |
isEmpty()
Accessor for whether the Collection is empty.
|
boolean |
isLoaded()
Method to return if the SCO has its contents loaded.
|
Iterator |
iterator()
Accessor for an iterator for the Collection.
|
void |
load()
Method to effect the load of the data in the SCO.
|
void |
makeDirty()
Utility to mark the object as dirty
|
java.util.stream.Stream |
parallelStream() |
boolean |
remove(Object element)
Method to remove an element from the List
|
boolean |
remove(Object element,
boolean allowCascadeDelete)
Method to remove an element from the List
|
boolean |
removeAll(Collection elements)
Method to remove a Collection of elements.
|
boolean |
removeIf(java.util.function.Predicate filter) |
boolean |
retainAll(Collection c)
Method to retain a Collection of elements (and remove all others).
|
void |
setValue(Collection<E> value)
Method to change the delegate value this wraps (to save recreating the wrapper).
|
int |
size()
Accessor for the size of the Collection.
|
Spliterator |
spliterator() |
java.util.stream.Stream |
stream() |
Object[] |
toArray()
Method to return the Collection as an array.
|
Object[] |
toArray(Object[] a)
Method to return the Collection as an array.
|
void |
unsetOwner()
Method to unset the owner and field information.
|
void |
updateEmbeddedElement(E element,
int fieldNumber,
Object value,
boolean makeDirty)
Method to update an embedded element in this collection.
|
protected Object |
writeReplace()
The writeReplace method is called when ObjectOutputStream is preparing
to write the object to the stream.
|
toString
protected transient ObjectProvider ownerOP
protected transient AbstractMemberMetaData ownerMmd
protected Collection<E> delegate
public Collection(ObjectProvider ownerOP, AbstractMemberMetaData mmd)
ownerOP
- The ObjectProvider for this collection.mmd
- Metadata for the memberpublic void initialise(Collection<E> newValue, Object oldValue)
SCO
initialise
in interface SCO<Collection<E>>
newValue
- New value (to wrap)oldValue
- Old value (to use in deciding what needs deleting etc)public void initialise(Collection c)
SCO
initialise
in interface SCO<Collection<E>>
c
- the object from which to copy the value.public void initialise()
SCO
initialise
in interface SCO<Collection<E>>
public Collection<E> getValue()
getValue
in interface SCO<Collection<E>>
public void setValue(Collection<E> value)
SCOContainer
setValue
in interface SCOContainer<Collection<E>>
value
- The new valuepublic void load()
load
in interface SCOContainer<Collection<E>>
public boolean isLoaded()
isLoaded
in interface SCOContainer<Collection<E>>
public void updateEmbeddedElement(E element, int fieldNumber, Object value, boolean makeDirty)
updateEmbeddedElement
in interface SCOCollection<Collection<E>,E>
element
- The elementfieldNumber
- Number of field in the elementvalue
- New value for this fieldmakeDirty
- Whether to make the SCO field dirty.public String getFieldName()
getFieldName
in interface SCO<Collection<E>>
public Object getOwner()
getOwner
in interface SCO<Collection<E>>
public void unsetOwner()
unsetOwner
in interface SCO<Collection<E>>
public void makeDirty()
public Collection detachCopy(FetchPlanState state)
detachCopy
in interface SCO<Collection<E>>
state
- State for detachment processpublic void attachCopy(Collection value)
attachCopy
in interface SCO<Collection<E>>
value
- The new (collection) valuepublic Object clone()
Mutable second-class Objects are required to provide a public clone method in order to allow for copying persistable objects. In contrast to Object.clone(), this method must not throw a CloneNotSupportedException.
public boolean contains(Object element)
contains
in interface Collection<E>
contains
in class AbstractCollection<E>
element
- The elementpublic boolean containsAll(Collection c)
containsAll
in interface Collection<E>
containsAll
in class AbstractCollection<E>
c
- The collection of elements.public boolean equals(Object o)
equals
in interface Collection<E>
equals
in class Object
o
- The object to compare against.public int hashCode()
hashCode
in interface Collection<E>
hashCode
in class Object
public boolean isEmpty()
isEmpty
in interface Collection<E>
isEmpty
in class AbstractCollection<E>
public Iterator iterator()
iterator
in interface Iterable<E>
iterator
in interface Collection<E>
iterator
in class AbstractCollection<E>
public int size()
size
in interface Collection<E>
size
in class AbstractCollection<E>
public Object[] toArray()
toArray
in interface Collection<E>
toArray
in class AbstractCollection<E>
public Object[] toArray(Object[] a)
toArray
in interface Collection<E>
toArray
in class AbstractCollection<E>
a
- The array to write the results topublic boolean add(E element)
add
in interface Collection<E>
add
in class AbstractCollection<E>
element
- The element to addpublic boolean addAll(Collection c)
addAll
in interface Collection<E>
addAll
in class AbstractCollection<E>
c
- The collection of elements to add.public void clear()
clear
in interface Collection<E>
clear
in class AbstractCollection<E>
public boolean remove(Object element)
remove
in interface Collection<E>
remove
in class AbstractCollection<E>
element
- The Element to removepublic boolean remove(Object element, boolean allowCascadeDelete)
remove
in interface SCOCollection<Collection<E>,E>
element
- The Element to removeallowCascadeDelete
- Whether to allow cascade deletepublic boolean removeAll(Collection elements)
removeAll
in interface Collection<E>
removeAll
in class AbstractCollection<E>
elements
- The collection to removepublic boolean retainAll(Collection c)
retainAll
in interface Collection<E>
retainAll
in class AbstractCollection<E>
c
- The collection to retainprotected Object writeReplace() throws ObjectStreamException
ObjectStreamException
- If an error occurspublic java.util.stream.Stream stream()
stream
in interface Collection<E>
public java.util.stream.Stream parallelStream()
parallelStream
in interface Collection<E>
public void forEach(java.util.function.Consumer action)
public Spliterator spliterator()
spliterator
in interface Iterable<E>
spliterator
in interface Collection<E>
public boolean removeIf(java.util.function.Predicate filter)
removeIf
in interface Collection<E>
Copyright © 2018. All rights reserved.