com.ibm.websphere.ola
Class IndexedRecordImpl
- java.lang.Object
-
- com.ibm.websphere.ola.IndexedRecordImpl
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, javax.resource.cci.IndexedRecord, javax.resource.cci.Record
public class IndexedRecordImpl extends java.lang.Object implements javax.resource.cci.IndexedRecord
Implementation of the IndexedRecord interface used by the Optimized Local Adapter (OLA). This implementation should be obtained through the RecordFactory provided by the cci.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description IndexedRecordImpl()
Public, general purpose constructor
-
Method Summary
Methods Modifier and Type Method and Description void
add(int index, java.lang.Object o)
Adds an element to the record.boolean
add(java.lang.Object o)
Adds an element to the record.boolean
addAll(java.util.Collection c)
Adds all of the elements of the collection to the record.boolean
addAll(int index, java.util.Collection c)
Adds all the elements of the collection to the record at the specified index.void
clear()
Clears the record of all data.java.lang.Object
clone()
Makes a copy of the list.boolean
contains(java.lang.Object o)
Searches the record for the specified entry.boolean
containsAll(java.util.Collection c)
Searches the record for the specified entrys.java.lang.Object
get(int index)
Retrieves an object from the record at the specified index.java.lang.String
getRecordName()
Gets the record name (created by the client)java.lang.String
getRecordShortDescription()
Gets the descriptionint
indexOf(java.lang.Object o)
Gets the index of a particular entry.boolean
isEmpty()
Checks to see if the record is emptyjava.util.Iterator
iterator()
Gets an iterator over the recordsint
lastIndexOf(java.lang.Object o)
Gets the last index of a particular entry.java.util.ListIterator
listIterator()
Gets a list iterator over the records.java.util.ListIterator
listIterator(int index)
Gets a list iterator starting at the specified index.java.lang.Object
remove(int index)
Removes a specified element from the list, based on index.boolean
remove(java.lang.Object o)
Removes an object from the list.boolean
removeAll(java.util.Collection c)
Removes all members of the specified collection.boolean
retainAll(java.util.Collection c)
This operation is not supported.java.lang.Object
set(int index, java.lang.Object o)
Sets an element at a given index.void
setRecordName(java.lang.String arg0)
Sets the record namevoid
setRecordShortDescription(java.lang.String arg0)
Sets the descriptionint
size()
Returns the size of the record (number of elements).java.util.List
subList(int fromIndex, int toIndex)
Returns a portion of the record, as a list.java.lang.Object[]
toArray()
Creates an array of byte[] objects representing the elements of this record.java.lang.Object[]
toArray(java.lang.Object[] a)
Returns an array of byte[] objects.
-
-
-
Method Detail
-
getRecordName
public java.lang.String getRecordName()
Gets the record name (created by the client)- Specified by:
getRecordName
in interfacejavax.resource.cci.Record
- Returns:
- The name of the record
-
getRecordShortDescription
public java.lang.String getRecordShortDescription()
Gets the description- Specified by:
getRecordShortDescription
in interfacejavax.resource.cci.Record
- Returns:
- The description
-
setRecordName
public void setRecordName(java.lang.String arg0)
Sets the record name- Specified by:
setRecordName
in interfacejavax.resource.cci.Record
- Parameters:
arg0
- The name of the record
-
setRecordShortDescription
public void setRecordShortDescription(java.lang.String arg0)
Sets the description- Specified by:
setRecordShortDescription
in interfacejavax.resource.cci.Record
- Parameters:
arg0
- The description of the record
-
add
public boolean add(java.lang.Object o)
Adds an element to the record. The element can be a byte[] or can be a Record instance created by the RAD or RD/z tooling. The element is added at the end of the list.- Specified by:
add
in interfacejava.util.Collection
- Specified by:
add
in interfacejava.util.List
- Parameters:
o
- The record or byte[] to add.- Returns:
- true if the record was added successfully
-
add
public void add(int index, java.lang.Object o)
Adds an element to the record. The element can be a byte[] or can be a Record instance created by the RAD or RD/z tooling. The element is added at the specified index, as per the java.util.List contract.- Specified by:
add
in interfacejava.util.List
- Parameters:
index
- The index at which to add the objecto
- The byte[] or Record to insert
-
addAll
public boolean addAll(java.util.Collection c)
Adds all of the elements of the collection to the record.- Specified by:
addAll
in interfacejava.util.Collection
- Specified by:
addAll
in interfacejava.util.List
- Parameters:
c
- The collection of objects to add.- Returns:
- true if the collection was added successfully
-
addAll
public boolean addAll(int index, java.util.Collection c)
Adds all the elements of the collection to the record at the specified index.- Specified by:
addAll
in interfacejava.util.List
- Parameters:
index
- The index at which to add the collectionc
- The collection of objects to add- Returns:
- true if the add was successful
-
clear
public void clear()
Clears the record of all data.- Specified by:
clear
in interfacejava.util.Collection
- Specified by:
clear
in interfacejava.util.List
-
contains
public boolean contains(java.lang.Object o)
Searches the record for the specified entry. The binary data (either the byte[] or the data within the Record objects) are used to compare the entries, and thus this is an expensive operation. Null entries are not allowed and will never be matched.- Specified by:
contains
in interfacejava.util.Collection
- Specified by:
contains
in interfacejava.util.List
- Parameters:
o
- The object for which to check- Returns:
- true if the object was found
-
containsAll
public boolean containsAll(java.util.Collection c)
Searches the record for the specified entrys. The binary data (either the byte[] or the data within the Record objects) are used to compare the entries, and thus this is an expensive operation. Null entries are not allowed and will never be matched.- Specified by:
containsAll
in interfacejava.util.Collection
- Specified by:
containsAll
in interfacejava.util.List
- Parameters:
c
- The collection of objects to search for- Returns:
- true if all the objects were found
-
get
public java.lang.Object get(int index)
Retrieves an object from the record at the specified index.- Specified by:
get
in interfacejava.util.List
- Parameters:
index
- The index at which to get the object- Returns:
- The object
-
indexOf
public int indexOf(java.lang.Object o)
Gets the index of a particular entry. The byte[] representation of the object is used to compare for equality.- Specified by:
indexOf
in interfacejava.util.List
- Parameters:
o
- The object to search for- Returns:
- The index of the object, or -1 if not found.
-
isEmpty
public boolean isEmpty()
Checks to see if the record is empty- Specified by:
isEmpty
in interfacejava.util.Collection
- Specified by:
isEmpty
in interfacejava.util.List
- Returns:
- true if the record is empty
-
iterator
public java.util.Iterator iterator()
Gets an iterator over the records- Specified by:
iterator
in interfacejava.lang.Iterable
- Specified by:
iterator
in interfacejava.util.Collection
- Specified by:
iterator
in interfacejava.util.List
- Returns:
- An iterator over the records within this indexed record
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
Gets the last index of a particular entry. The byte[] representation of the object is used to compare for equality.- Specified by:
lastIndexOf
in interfacejava.util.List
- Parameters:
o
- The object to search for- Returns:
- The index of the object, or -1 if not found.
-
listIterator
public java.util.ListIterator listIterator()
Gets a list iterator over the records. The records returned in the iterator are in their raw serialized form (byte[]).- Specified by:
listIterator
in interfacejava.util.List
- Returns:
- A ListIterator over the records within this indexed record.
-
listIterator
public java.util.ListIterator listIterator(int index)
Gets a list iterator starting at the specified index. The records returned in the iterator are in their raw serialized form (byte[]).- Specified by:
listIterator
in interfacejava.util.List
- Returns:
- A ListIterator over the records within this indexed record.
-
remove
public boolean remove(java.lang.Object o)
Removes an object from the list. The raw byte[] version of the object is used to find the correct element.- Specified by:
remove
in interfacejava.util.Collection
- Specified by:
remove
in interfacejava.util.List
- Parameters:
o
- The object to remove- Returns:
- true if the object was found and removed.
-
remove
public java.lang.Object remove(int index)
Removes a specified element from the list, based on index. If removed, the object returned represents the raw serialized form (byte[]) of the object.- Specified by:
remove
in interfacejava.util.List
- Parameters:
index
- The index that should be removed- Returns:
- The object instance that was removed.
-
removeAll
public boolean removeAll(java.util.Collection c)
Removes all members of the specified collection. The raw serialized (byte[]) version of the elements are used to perform the comparison.- Specified by:
removeAll
in interfacejava.util.Collection
- Specified by:
removeAll
in interfacejava.util.List
- Parameters:
c
- The collection of objects to remove.- Returns:
- true if all the object in the collection were removed.
-
retainAll
public boolean retainAll(java.util.Collection c)
This operation is not supported.- Specified by:
retainAll
in interfacejava.util.Collection
- Specified by:
retainAll
in interfacejava.util.List
- Throws:
java.lang.UnsupportedOperationException
-
set
public java.lang.Object set(int index, java.lang.Object o)
Sets an element at a given index. The object at that element (if any) is returned. The byte[] representation of the object is returned, regardless of what type of item was used to set it initially.- Specified by:
set
in interfacejava.util.List
- Parameters:
index
- The index at which to set the objecto
- The object to set- Returns:
- The object which was previously at the given index. The object is returned in byte[] form.
-
size
public int size()
Returns the size of the record (number of elements).- Specified by:
size
in interfacejava.util.Collection
- Specified by:
size
in interfacejava.util.List
- Returns:
- The number of elements in this indexed record
-
subList
public java.util.List subList(int fromIndex, int toIndex)
Returns a portion of the record, as a list. The list elements represent the byte[] versions of the data.- Specified by:
subList
in interfacejava.util.List
- Parameters:
fromIndex
- The index from which to starttoIndex
- The index at which to end- Returns:
- A List spanning the two indexes.
-
toArray
public java.lang.Object[] toArray()
Creates an array of byte[] objects representing the elements of this record.- Specified by:
toArray
in interfacejava.util.Collection
- Specified by:
toArray
in interfacejava.util.List
- Returns:
- The objects in this indexed record, as an array of Objects.
-
toArray
public java.lang.Object[] toArray(java.lang.Object[] a)
Returns an array of byte[] objects. The input array must be of type byte[][].- Specified by:
toArray
in interfacejava.util.Collection
- Specified by:
toArray
in interfacejava.util.List
- Parameters:
a
- An array of byte[] objects to be filled in.- Returns:
- The array of objects in byte[] form.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Makes a copy of the list.- Specified by:
clone
in interfacejavax.resource.cci.Record
- Overrides:
clone
in classjava.lang.Object
- Returns:
- A copy of this indexed record.
- Throws:
java.lang.CloneNotSupportedException
-
-