|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.datapower.wamt.StringCollection
public class StringCollection
A simple collection of Strings. This is used in multiple classes in the clientAPI package (task-level API) and the deviceCommunication package (AMP). This class is important because it has many helper methods, such as doing comparisons with subsets, non-sorted equality, etc.
WARNING: THIS CLASS IS NOT NLS ENABLED. It should only be used to store "data" type strings that are dynamically obtained from elsewhere. Examples would be features from firmware or domain names from a device.
Field Summary | |
---|---|
static java.lang.String |
COPYRIGHT_2009_2013
|
static StringCollection |
EMPTY
A representation of any empty collection. |
Constructor Summary | |
---|---|
StringCollection()
Create a new collection of Strings. |
|
StringCollection(java.lang.String[] array)
Create a new collection of Strings and initialize the collection with the contents of the array. |
|
StringCollection(StringCollection clonable)
Create a new collection of Strings that is a clone. |
|
StringCollection(StringCollection collection1,
StringCollection collection2)
Create a new StringCollection that is a merged instance of two other collections. |
Method Summary | |
---|---|
void |
add(java.lang.String string)
Add a new String into the collection. |
boolean |
contains(java.lang.String target)
Check if the collection contains the specified String. |
static StringCollection |
createCollectionFromDisplayName(java.lang.String s)
Create a StringCollection instance based on a string created by getDisplayName. |
static StringCollection |
createCollectionFromString(java.lang.String s,
char delimiter)
Create a StringCollection instance based on a string created by marshalToString. |
boolean |
equals(java.lang.Object that)
Check if the two collections have the same content. |
java.lang.String |
get(int index)
Get the String at the specified index in the collection. |
java.lang.String |
getDisplayName()
Create a human-readable representation of this collection that is intended for consumption by end users. |
int |
hashCode()
|
boolean |
isSupersetOf(StringCollection that)
Check if one collection (this) is a superset of another collection (that). |
java.lang.String |
marshalToString(char delimiter)
Get a String representation of the collection. |
void |
remove(java.lang.String string)
Remove the specified String object from the collection. |
int |
size()
Get the number of Strings currently in this collection. |
java.lang.String |
toString()
Create a human-readable representation of this collection. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final StringCollection EMPTY
add(String)
and remove(String)
have been
written to disallow changes to this singleton.
public static final java.lang.String COPYRIGHT_2009_2013
Constructor Detail |
---|
public StringCollection()
public StringCollection(java.lang.String[] array)
array
- the initial contents for the collection.public StringCollection(StringCollection clonable)
clonable
- the original collection to make a copy (clone) of.public StringCollection(StringCollection collection1, StringCollection collection2)
collection1
and
collection2
).
collection1
- a collection of Strings to be included in the merged
instancecollection2
- a collection of Strings to be included in the merged
instanceMethod Detail |
---|
public int size()
public java.lang.String get(int index)
index
- the index into the collection that locates the desired String
public java.lang.String marshalToString(char delimiter) throws DMgrException
delimiter
- The delimiter for each String in the collection that is
returned in the aggregate string
public static final StringCollection createCollectionFromString(java.lang.String s, char delimiter)
s
- The string created by marshalToStringdelimiter
- The delimiter passed to marshalToString
public void add(java.lang.String string)
string
- the String to add to the collection.public void remove(java.lang.String string)
string
- the String object to remove from the collection.contains(String)
public boolean contains(java.lang.String target)
String.equals
method is invoked instead of ==
, which means it will find
Strings of the same content even if they are different object instances.
target
- look for a String in the collection that has this contents
public boolean equals(java.lang.Object that)
.equals()
equivalence, not ==
equivalence. Also, sort order of the
collections is irrevelant, meaning that equivalency is not dependent on
the order of the Strings in the collection.
equals
in class java.lang.Object
that
- the other StringCollection to compare equivalency to
this
.
public int hashCode()
hashCode
in class java.lang.Object
public boolean isSupersetOf(StringCollection that)
that
- the collection which is a subset of this
public java.lang.String toString()
toString
in class java.lang.Object
getDisplayName()
public java.lang.String getDisplayName()
createCollectionFromDisplayName(String)
public static final StringCollection createCollectionFromDisplayName(java.lang.String s)
s
- The string created by getDisplayName. Since getDisplayName
separates members by ", ", embedded sequences of ", " in a member
will result in the member being split into 2 members.
getDisplayName()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |