org.eclipse.persistence.sdo.helper
Class ListWrapper

java.lang.Object
  extended by org.eclipse.persistence.sdo.helper.ListWrapper
All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection, List
Direct Known Subclasses:
JAXBListWrapper

public class ListWrapper
extends Object
implements List, Serializable, Cloneable

INTERNAL:

Purpose:

Responsibilities:

Since:
Oracle TopLink 11.1.1.0.0
See Also:
SDODataObject, Serialized Form

Constructor Summary
ListWrapper()
           
ListWrapper(SDODataObject theDataObject, commonj.sdo.Property theProperty)
           
ListWrapper(SDODataObject theDataObject, commonj.sdo.Property theProperty, List theList)
          Constructor for non-default Pluggable ValueStore implementations
Prerequisites: Containment is already set on theList parameter.
 
Method Summary
 void add(int index, Object item)
          Inserts the specified element at the index position in this list.
 void add(int index, Object item, boolean updateSequence)
          INTERNAL:
 boolean add(Object item)
           
 boolean add(Object item, boolean updateSequence)
          INTERNAL:
 boolean addAll(Collection items)
          Appends all of the currentElements in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator.
 boolean addAll(Collection items, boolean updateSequence)
          INTERNAL: Appends all of the currentElements in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator.
 boolean addAll(int position, Collection items)
          Inserts all of the currentElements in the specified Collection into this list, starting at the specified position.
 boolean addAll(int position, Collection items, boolean updateSequence)
           
 void clear()
          Removes all of the currentElements from this list.
 void clear(boolean updateSequence)
          INTERNAL:
 Object clone()
          Clone the ListWrapper.
 boolean contains(Object item)
           
 boolean containsAll(Collection items)
           
 Object get(int position)
           
 List getCurrentElements()
          INTERNAL:
 int indexOf(Object item)
           
 boolean isEmpty()
           
 Iterator iterator()
           
 int lastIndexOf(Object item)
           
 ListIterator listIterator()
           
 ListIterator listIterator(int position)
           
 Object remove(int index)
          Removes the element at the specified position in this list.
Position index starts at 0.
 Object remove(int index, boolean updateSequence)
          INTERNAL: Removes the element at the specified position in this list.
Position index starts at 0.
 boolean remove(Object item)
           
 boolean remove(Object item, boolean fromDelete, boolean updateSequence)
          INTERNAL: Remove the item or first occurrence of the item.
 boolean removeAll(Collection items)
          Removes from this collection all of its currentElements that are contained in the specified collection.
 boolean removeAll(Collection items, boolean updateSequence)
          INTERNAL: Removes from this collection all of its currentElements that are contained in the specified collection.
 boolean retainAll(Collection itemsToKeep)
          Retains only the currentElements in this collection that are contained in the specified collection (optional operation).
In other words, removes from this collection all of its currentElements that are not contained in the specified collection.
 Object set(int index, Object item)
          Replaces the element at the specified index in this list with the specified element.
 void setCurrentElements(List currentElementsList)
          INTERNAL: bypass containment and changesummary copy of element list on modifications
 int size()
           
 List subList(int start, int end)
          Return a view of the specified portion of the list
 Object[] toArray()
           
 Object[] toArray(Object[] items)
          Returns an array containing all of the currentElements in this list in proper sequence; the runtime type of the returned array is that of the specified array.
 void undoChanges(SDOChangeSummary cs)
          INTERNAL: Undo any changes and return the original List
 Object writeReplace()
          INTERNAL: Defined in SDO 2.01 spec on page 65 Externalizable function is called by ObjectStream.writeObject() A replacement object for serialization can be called here.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.List
equals, hashCode
 

Constructor Detail

ListWrapper

public ListWrapper()

ListWrapper

public ListWrapper(SDODataObject theDataObject,
                   commonj.sdo.Property theProperty)

ListWrapper

public ListWrapper(SDODataObject theDataObject,
                   commonj.sdo.Property theProperty,
                   List theList)
Constructor for non-default Pluggable ValueStore implementations
Prerequisites: Containment is already set on theList parameter. Do not use this constructor for default implementations as containment is not updated. The SDO Objects inside this ListWrapper are special case wrappers with no previous containment We do not call updateContainment on the SDO Wrapper objects surrounding the POJO's otherwise the containment of this list will be removed in the embedded detach() call TestCase: the first get on a list.

Method Detail

add

public boolean add(Object item)
Specified by:
add in interface Collection
Specified by:
add in interface List

add

public boolean add(Object item,
                   boolean updateSequence)
INTERNAL:

Parameters:
item -
updateSequence -
Returns:

add

public void add(int index,
                Object item)
Inserts the specified element at the index position in this list.

Specified by:
add in interface List
Parameters:
position - (start at 0 = prepend, length = append)
item -

add

public void add(int index,
                Object item,
                boolean updateSequence)
INTERNAL:

Parameters:
index -
item -
updateSequence -

undoChanges

public void undoChanges(SDOChangeSummary cs)
INTERNAL: Undo any changes and return the original List


remove

public boolean remove(Object item,
                      boolean fromDelete,
                      boolean updateSequence)
INTERNAL: Remove the item or first occurrence of the item.

Parameters:
item -
fromDelete -
updateSequence -
Returns:

remove

public boolean remove(Object item)
Specified by:
remove in interface Collection
Specified by:
remove in interface List
Parameters:
item -
Returns:

addAll

public boolean addAll(Collection items)
Appends all of the currentElements in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator. The behavior of this operation is undefined if the specified Collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified Collection is this list, and this list is nonempty.)
This operation is a special case of the general addAll(int, Collection).
From the SDO Specification: p18 The getList(property) accessor is especially convenient for many-valued properties. If property.many is true then set(property, value) and setList(property, value) require that [value] be a java.util.Collection and List respectively. These methods are equivalent to getList(property).clear() followed by getList(property).addAll(value).

Specified by:
addAll in interface Collection
Specified by:
addAll in interface List
Parameters:
items -
Returns:
boolean

addAll

public boolean addAll(Collection items,
                      boolean updateSequence)
INTERNAL: Appends all of the currentElements in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator. This function calls the public addAll(Collection) with a sequence state flag.

Parameters:
items -
updateSequence -
Returns:

addAll

public boolean addAll(int position,
                      Collection items)
Inserts all of the currentElements in the specified Collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent currentElements to the right (increases their indices). The new currentElements will appear in the list in the order that they are returned by the specified Collection's iterator.

Specified by:
addAll in interface List
Parameters:
position - (start at 0 = prepend, length = append)
items -
Returns:
boolean

addAll

public boolean addAll(int position,
                      Collection items,
                      boolean updateSequence)

removeAll

public boolean removeAll(Collection items)
Removes from this collection all of its currentElements that are contained in the specified collection.

Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface List
Parameters:
items -
Returns:
boolean

removeAll

public boolean removeAll(Collection items,
                         boolean updateSequence)
INTERNAL: Removes from this collection all of its currentElements that are contained in the specified collection.

Parameters:
items -
updateSequence -
Returns:

retainAll

public boolean retainAll(Collection itemsToKeep)
Retains only the currentElements in this collection that are contained in the specified collection (optional operation).
In other words, removes from this collection all of its currentElements that are not contained in the specified collection.

Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface List
Parameters:
itemsToKeep -
Returns:
boolean

clear

public void clear()
Removes all of the currentElements from this list. The list will be empty after this call returns.

Specified by:
clear in interface Collection
Specified by:
clear in interface List

clear

public void clear(boolean updateSequence)
INTERNAL:

Parameters:
updateSequence -

set

public Object set(int index,
                  Object item)
Replaces the element at the specified index in this list with the specified element.

Specified by:
set in interface List
Parameters:
index -
item -
Returns:
Object (the element previously at the specified position)

remove

public Object remove(int index,
                     boolean updateSequence)
INTERNAL: Removes the element at the specified position in this list.
Position index starts at 0.

Parameters:
index -
updateSequence -
Returns:
Object (the element previously at the specified position)

remove

public Object remove(int index)
Removes the element at the specified position in this list.
Position index starts at 0.

Specified by:
remove in interface List
Parameters:
index -
Returns:
Object (the element previously at the specified position)

listIterator

public ListIterator listIterator()
Specified by:
listIterator in interface List

listIterator

public ListIterator listIterator(int position)
Specified by:
listIterator in interface List

subList

public List subList(int start,
                    int end)
Return a view of the specified portion of the list

Specified by:
subList in interface List
Parameters:
start - - low endpoint (inclusive) of the subList.
end - - high endpoint (exclusive) of the subList.
Returns:

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection
Specified by:
toArray in interface List

toArray

public Object[] toArray(Object[] items)
Returns an array containing all of the currentElements in this list in proper sequence; the runtime type of the returned array is that of the specified array. Obeys the general contract of the Collection.toArray(Object[]) method.
Specified by: toArray in interface Collection
Throws:
ArrayStoreException - if the runtime type of the specified array is not a supertype of the runtime type of every element in this list.
NullPointerException - if the specified array is null.

Specified by:
toArray in interface Collection
Specified by:
toArray in interface List
Parameters:
items - -the array into which the currentElements of this list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.
Returns:
Object[] - an array containing the currentElements of this list.

size

public int size()
Specified by:
size in interface Collection
Specified by:
size in interface List

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection
Specified by:
isEmpty in interface List

contains

public boolean contains(Object item)
Specified by:
contains in interface Collection
Specified by:
contains in interface List

containsAll

public boolean containsAll(Collection items)
Specified by:
containsAll in interface Collection
Specified by:
containsAll in interface List

iterator

public Iterator iterator()
Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface List

indexOf

public int indexOf(Object item)
Specified by:
indexOf in interface List

lastIndexOf

public int lastIndexOf(Object item)
Specified by:
lastIndexOf in interface List

get

public Object get(int position)
Specified by:
get in interface List

writeReplace

public Object writeReplace()
INTERNAL: Defined in SDO 2.01 spec on page 65 Externalizable function is called by ObjectStream.writeObject() A replacement object for serialization can be called here.

Security Note: This public function exposes a data replacement vulnerability where an outside client can gain access and modify their non-final constants. We may need to wrap the GZIP streams in some sort of encryption when we are not using HTTPS or SSL/TLS on the wire.

See Also:
SDOResolvable

getCurrentElements

public List getCurrentElements()
INTERNAL:

Returns:

setCurrentElements

public void setCurrentElements(List currentElementsList)
INTERNAL: bypass containment and changesummary copy of element list on modifications


clone

public Object clone()
Clone the ListWrapper. This creates a new ListWrapper with the same contents as the original (shallow clone) Minimal clone operation implemented to support usage in JPA

Overrides:
clone in class Object