com.intersys.objects
Class SList

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended bycom.intersys.objects.SList
All Implemented Interfaces:
Collection, List

public class SList
extends AbstractList

This class implements client side representation for Cache $LIST data type. Created: Wed Oct 10 05:41:25 2001


Constructor Summary
SList()
           
SList(Object list)
          Creates a new SList wrapped around given SysList object and sets encoding to default.
SList(Object list, boolean doNotChangeLocale)
          Creates a new SList wrapped around given SysList object.
 
Method Summary
 boolean add(Object o)
          Adds a single object to the end of SList.
 boolean addAll(Collection c)
           
static SList build(boolean o)
          Creates a SList containing a single boolean value.
static SList build(byte o)
          Creates a SList containing a single byte.
static SList build(char o)
          Creates a SList containing a single byte.
static SList build(double o)
          Creates a SList containing a single double value.
static SList build(float o)
          Creates a SList containing a single float value.
static SList build(int o)
          Creates a SList containing a single integer.
static SList build(long o)
          Creates a SList containing a single long.
static SList build(Object o)
          Creates a SList containing a single object.
static SList buildAll(Collection c)
          Creates a SList containing all elements from collection c.
 void clear()
           
 boolean equals(Object o)
           
 Object get(int index)
           
 Object getAs(int index, Class clazz)
          Returns object at index index represented as object of a class clazz.
 Object getAs(int index, Object obj)
          Returns object at index index represented as object of the same type as obj.
 Object getAs(int index, String type)
          Returns object at index index represented as object of type type.
 byte[] getData()
           
 void setEncoding(String encoding)
           
 int size()
           
 SList sublist(int start, int end)
          Returns the SList consiting of items of this SList starting with start and eding with end - 1.
 String toString()
           
 
Methods inherited from class java.util.AbstractList
add, addAll, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, set, subList
 
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

SList

public SList()

SList

public SList(Object list)
Creates a new SList wrapped around given SysList object and sets encoding to default.

Parameters:
list - SysList object

SList

public SList(Object list,
             boolean doNotChangeLocale)
Creates a new SList wrapped around given SysList object.

Parameters:
list - SysList object
doNotChangeLocale - if true does not change encoding of underlined list object.
Method Detail

setEncoding

public void setEncoding(String encoding)

getAs

public Object getAs(int index,
                    String type)
             throws CacheException
Returns object at index index represented as object of type type.

Parameters:
index - index in list
type - name of desired return type
Returns:
object at index index represented as object of type type
Throws:
CacheException - if data in the list at specified index can not be represented as type

getAs

public Object getAs(int index,
                    Class clazz)
             throws CacheException
Returns object at index index represented as object of a class clazz.

Parameters:
index - index in list
clazz - specification of return type.
Returns:
object at index index represented as object of type type
Throws:
CacheException - if data in the list at specified index can not be represented as type, specified by clazz

getAs

public Object getAs(int index,
                    Object obj)
             throws CacheException
Returns object at index index represented as object of the same type as obj.

Parameters:
index - index in list. Index of the first element in list is 0 to conform with method get defined in java.util.List interface.
obj - used only for obtaining type.
Returns:
object at index index represented as object of type type
Throws:
CacheException - if data in the list at specified index can not be represented as the same type as obj

get

public Object get(int index)

size

public int size()

toString

public String toString()

sublist

public SList sublist(int start,
                     int end)
Returns the SList consiting of items of this SList starting with start and eding with end - 1.

Parameters:
start - the first element of this List to be copied to the target List
end - the element after the last element of this List that was copied to target List.
Returns:
a SList object which is a sublist of this List.

getData

public byte[] getData()

add

public boolean add(Object o)
Adds a single object to the end of SList.

Parameters:
o - A single object of one of supported types or a collection of objects.
Returns:
Always true.
See Also:
List.add(java.lang.Object), build(java.lang.Object), addAll(java.util.Collection)

addAll

public boolean addAll(Collection c)

build

public static SList build(Object o)
Creates a SList containing a single object.

Parameters:
o - An object of one of supported types or a collection of objects.
Returns:
SList object which contains a single object.
See Also:
add(java.lang.Object), buildAll(java.util.Collection)

build

public static SList build(char o)
Creates a SList containing a single byte.

Parameters:
o - A char to add to the SList
Returns:
SList object which contains a single object of type char.
See Also:
buildAll(java.util.Collection)

build

public static SList build(byte o)
Creates a SList containing a single byte.

Parameters:
o - A byte to add to the SList
Returns:
SList object which contains a single object of type byte.
See Also:
buildAll(java.util.Collection)

build

public static SList build(int o)
Creates a SList containing a single integer.

Parameters:
o - An integer to add to the SList
Returns:
SList object which contains a single object of type Integer.
See Also:
buildAll(java.util.Collection)

build

public static SList build(long o)
Creates a SList containing a single long.

Parameters:
o - A long value to add to the SList
Returns:
SList object which contains a single object of type Integer.
See Also:
buildAll(java.util.Collection)

build

public static SList build(float o)
Creates a SList containing a single float value.

Parameters:
o - A float value to add to the SList
Returns:
SList object which contains a single object of type Double.
See Also:
buildAll(java.util.Collection)

build

public static SList build(double o)
Creates a SList containing a single double value.

Parameters:
o - A double value to add to the SList
Returns:
SList object which contains a single object of type Double.
See Also:
buildAll(java.util.Collection)

build

public static SList build(boolean o)
Creates a SList containing a single boolean value.

Parameters:
o - A boolean value to add to the SList
Returns:
SList object which contains a single object of type Boolean.
See Also:
buildAll(java.util.Collection)

buildAll

public static SList buildAll(Collection c)
Creates a SList containing all elements from collection c. All elements in collection must be of supported types.

Parameters:
c - a collection of elements to add to SList.
Returns:
SList object which contains all elements from collection c
See Also:
build(java.lang.Object)

clear

public void clear()

equals

public boolean equals(Object o)