|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hyperic.util.StrongCollection
org.hyperic.util.StrongList
public class StrongList
StrongList is a collection class, ArrayList that will only accept objects into the collection of a type specified when constructing the collection. StrongCollection's are subclassed to to create a type specific collection (e.g., FooCollection extends StrongCollection). In this example, FooCollection would only accept objects of type Foo. StrongCollection enforces the Collection checks at runtime. Subclassing the StrongCollection class and providing stub implementions of methods like add(Foo element) adds compile time checks. StrongList supports all of the methods of the java.util.List interface. StrongList also returns a ListIterator from the StrongList.listIterator() method call. The ListIterator.add() and ListIterator.remove() call also enforce that only objects allowed by the StrongList will be allowed into the collection.
List
Nested Class Summary | |
---|---|
protected class |
StrongList.ListItr
|
Nested classes/interfaces inherited from class org.hyperic.util.StrongCollection |
---|
StrongCollection.Itr |
Field Summary |
---|
Fields inherited from class org.hyperic.util.StrongCollection |
---|
CLASS_NOT_FOUND_MSG, m_aList |
Constructor Summary | |
---|---|
protected |
StrongList()
Constructs a StrongCollection class. |
|
StrongList(java.lang.Class object)
Constructs a StrongList class. |
|
StrongList(java.lang.Class collection,
java.lang.Class object)
Constructs a StrongList class. |
|
StrongList(java.lang.String object)
Constructs a StrongList class. |
protected |
StrongList(java.lang.String coll,
java.lang.String obj)
Constructs a StrongList class. |
Method Summary | |
---|---|
void |
add(int index,
java.lang.Object element)
Inserts the specified element into specified position in the collection. |
boolean |
addAll(int index,
java.util.Collection c)
Inserts the elements of the specified collection to this collection. |
protected void |
checkCollection(java.util.Collection collection)
Checks whether a Collection object is of the type specified when constructing the StrongBase class and throws a ClassCastException if it is not. |
protected void |
checkObject(java.lang.Object obj)
Checks whether a object is of the type that the collection accepts and throws a ClassCastException if it is not. |
java.lang.Object |
get(int index)
Retries the element at the specified index from the collection. |
protected java.lang.Class |
getCollectionClass()
Returns the collection Class. |
protected java.lang.Class |
getObjectClass()
Returns the object Class of the objects accepted by a Collection. |
int |
indexOf(java.lang.Object element)
Searches for the first occurrence of the specified element in the collection. |
protected void |
init(java.lang.Class coll,
java.lang.Class obj)
Initializes a StrongBase class. |
protected void |
init(java.lang.String coll,
java.lang.String obj)
Initializes a StrongBase class. |
protected boolean |
isValidCollection(java.util.Collection collection)
Returns whether a Collection object is of the type specified when constructing the StrongBase class. |
protected boolean |
isValidObject(java.lang.Object obj)
Returns whether an object is of the type that the collection accepts. |
int |
lastIndexOf(java.lang.Object element)
Searches for the last occurrence of the specified element in the collection. |
java.util.ListIterator |
listIterator()
Returns a ListIterator of the elements in the collection. |
java.util.ListIterator |
listIterator(int index)
Returns a ListIterator of the elements in the collection starting at the specified index. |
java.lang.Object |
remove(int index)
Removes the specified element from the collection. |
java.lang.Object |
set(int index,
java.lang.Object element)
Replaces the element at the specified position in the collection. |
java.util.List |
subList(int fromIndex,
int toIndex)
Returns a view of a portion of the collection. |
Methods inherited from class org.hyperic.util.StrongCollection |
---|
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, reverse, size, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Constructor Detail |
---|
protected StrongList()
public StrongList(java.lang.Class collection, java.lang.Class object)
collection
- The java.lang.Class type of the subclassed collection.object
- The java.lang.Class type of the object this collection will accept.protected StrongList(java.lang.String coll, java.lang.String obj) throws java.lang.ClassNotFoundException
collection
- The java.lang.String type that specifies the fully qualified class
name of the subclassed collection.object
- The java.lang.String type that specifies the fully qualified class
name of the class this collection will accept.
java.lang.ClassNotFoundException
public StrongList(java.lang.Class object)
object
- The java.lang.Class type of the object this collection will accept.public StrongList(java.lang.String object)
object
- The java.lang.Class type of the object this collection will accept.Method Detail |
---|
public void add(int index, java.lang.Object element)
add
in interface java.util.List
index
- The zero-based index where the element should be inserted.element
- The object to add to the list.
java.lang.ClassCastException
- If the element is not of the type accepted by the collection.public boolean addAll(int index, java.util.Collection c)
addAll
in interface java.util.List
c
- The collection to insert into this collection.
java.lang.ClassCastException
- If the specified collection is not the same type as this collection.public java.lang.Object get(int index)
get
in interface java.util.List
index
- The zero-based index where the element should be retrieved from.
public int indexOf(java.lang.Object element)
indexOf
in interface java.util.List
element
- The element to search for.
java.lang.ClassCastException
- If the element is not of the type accepted by the collection.public int lastIndexOf(java.lang.Object element)
lastIndexOf
in interface java.util.List
element
- The element to search for.
java.lang.ClassCastException
- If the element is not of the type accepted by the collection.public java.util.ListIterator listIterator()
listIterator
in interface java.util.List
public java.util.ListIterator listIterator(int index)
listIterator
in interface java.util.List
public java.lang.Object remove(int index)
remove
in interface java.util.List
index
- The zero-based index of the element to remove from the collection.
public java.lang.Object set(int index, java.lang.Object element)
set
in interface java.util.List
index
- The zero-based index where the element should be replaced.element
- The object to store at the specified index in the collection.
java.lang.ClassCastException
- If the element is not of the type accepted by the collection.public java.util.List subList(int fromIndex, int toIndex)
subList
in interface java.util.List
fromIndex
- The zero-based index where the SubList should start from.toIndex
- The zero-based index where the SubList should go to.protected void init(java.lang.Class coll, java.lang.Class obj)
c
- The java.lang.Class object of the collection class that will use
the StrongBase. The collection class must implement the
java.util.Collection interface or a sublcass of this interface.obj
- The java.lang.Class object of the class that the collection will
contain. The obj Class can be any type that can be implemented
in the Java language.Collection
protected void init(java.lang.String coll, java.lang.String obj) throws java.lang.ClassNotFoundException
c
- The java.lang.Class object of the collection class that will use
the StrongBase. The collection class must implement the
java.util.Collection interface or a sublcass of this interface.obj
- The java.lang.Class object of the class that the collection will
contain. The obj Class can be any type that can be implemented
in the Java language.
java.lang.ClassNotFoundException
Collection
protected void checkCollection(java.util.Collection collection)
collection
- The java.lang.Class object of the collection class that will use
the StrongBase. This methods throws a ClassCastException if the
paramater is not valid.ClassCastException
,
Collection
protected void checkObject(java.lang.Object obj)
obj
- The java.lang.Class object of the collection class that will use
the StrongBase. This methods throws a ClassCastException if the
paramater is not valid.ClassCastException
protected java.lang.Class getCollectionClass()
Class
protected java.lang.Class getObjectClass()
Class
protected boolean isValidCollection(java.util.Collection collection)
collection
- The java.lang.Class object of the collection class that will use
the StrongBase. This methods throws a ClassCastException if the
paramater is not valid.
Collection
protected boolean isValidObject(java.lang.Object obj)
obj
- The java.lang.Class object of the collection class that will use
the StrongBase.
|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |