com.ibm.security.certclient.base
Class PkAttrs
- java.lang.Object
com.ibm.security.certclient.base.PkAttrs
All implemented interfaces:
- public final class PkAttrs
- extends Object
- implements Serializable, Cloneable
PkAttr
s.
This class implements most of the methods defined for Collection
, but instead of using Object
s in the method
signatures, it uses the proper classes for a PkAttrs
.
An invariant maintained by this class is that none of its elements have a
null
value.
Author:
Rod Mancisidor
See Also:
Nested Class Summary
Modifier and Type | Class and Description |
---|---|
|
PkAttrs.Iter
An iterator for the attrs in a
PkAttrs collection.
|
Constructor Summary
Constructor and Description |
---|
PkAttrs()
Construct an empty set of attributes.
|
Method Summary
Modifier and Type | Method and Description |
---|---|
|
add(PkAttr attr)
Adds an attribute to the set.
|
|
add(String name,int kind,Object value)
Creates and adds an attribute to the set.
|
|
addIfNotThere(String name,int kind,Object value)
Adds the attribute with the given name, fails silently if attribute
is already in the set or if value is null.
|
|
clear()
Remove all elements of the set.
|
clone()
Returns a shallow copy of this object.
|
|
get(String name)
Returns the attribute with the given name.
|
|
get(String name,PkAttr defaultAttr)
Returns the attribute with the given
name .
|
|
|
getKind(String name)
Returns the kind of the attribute with the given name.
|
|
getKind(String name,int defaultKind)
Returns the kind of the attribute with the given name.
|
getString(String name)
Returns the value of the attribute with the given name as a
String .
|
|
getString(String name,String defaultValue)
Returns the value of the attribute with the given name as a
String .
|
|
getStringIgnoreCase(String name)
Returns the value of the attribute with the given name as a
String .
|
|
getStringIgnoreCase(String name,String defaultValue)
Returns the value of the attribute with the given name as a
String .
|
|
getValue(String name)
Returns the value of the attribute with the given name.
|
|
getValue(String name,Object defaultValue)
Returns the value of the attribute with the given name.
|
|
getValueIgnoreCase(String name)
Returns the value of the attribute with the given name.
|
|
getValueIgnoreCase(String name,Object defaultValue)
Returns the value of the attribute with the given name.
|
|
|
has(String name)
Returns true if and only if the attribute with the given name is in the
set.
|
|
isEmpty()
Returns true if and only if the set of attributes is not empty.
|
iterator()
|
|
remove(String name)
Removes a named attribute from this set.
|
|
|
repOrAdd(String name,int kind,Object value)
Replaces the attribute with the given name, adds it if it does not
exist.
|
|
size()
Returns the number of attributes in the set.
|
toString()
Returns a string representation of this object.
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail
PkAttrs
- public PkAttrs()
Construct an empty set of attributes.
Method Detail
size
- public int size()
Returns the number of attributes in the set.
isEmpty
- public boolean isEmpty()
Returns true if and only if the set of attributes is not empty.
iterator
- public PkAttrs.Iter iterator()
has
- public boolean has(String name)
Returns true if and only if the attribute with the given name is in the
set.
get
Returns the attribute with the given name.
Returns:
the attribute with the given name.
Throws:
NoSuchElementException
- if the attribute with the given name
does not exist. get
Returns the attribute with the given
name
.
Returns:
the attribute with the given name or defaultAttr if not found.
getValue
Returns the value of the attribute with the given name.
Returns:
the value of the attribute with the given name.
Throws:
NoSuchElementException
- if the attribute with the given name
does not exist. getValue
Returns the value of the attribute with the given name.
Returns:
the value of the attribute with the given name or
defaultValue
if not found. getString
Returns the value of the attribute with the given name as a
String
.
Returns:
the value of the attribute with the given name as a
String
. Throws:
NoSuchElementException
- if the attribute with the given name
does not exist. getString
Returns the value of the attribute with the given name as a
String
.
Returns:
the value of the attribute with the given name or
defaultValue
if not found. Throws:
NoSuchElementException
- if the attribute with the given name
does not exist. getValueIgnoreCase
Returns the value of the attribute with the given name. The name is
case-insensitive.
Returns:
the value of the attribute with the given name.
Throws:
NoSuchElementException
- if the attribute with the given name does
not exist. getValueIgnoreCase
Returns the value of the attribute with the given name. The name is
case-insensitive.
Returns:
the value of the attribute with the given name or
defaultValue
if not found. getStringIgnoreCase
Returns the value of the attribute with the given name as a
String
. The name is case-insensitive.
Returns:
the value of the attribute with the given name as a
String
. Throws:
NoSuchElementException
- if the attribute with the given name
does not exist. getStringIgnoreCase
Returns the value of the attribute with the given name as a
String
. The name is case-insensitive.
Returns:
the value of the attribute with the given name or
defaultValue
if not found. Throws:
NoSuchElementException
- if the attribute with the given name
does not exist. getKind
- public int getKind(String name)
Returns the kind of the attribute with the given name.
Returns:
the kind of the attribute with the given name
Throws:
NoSuchElementException
- if the attribute does not exist getKind
- public int getKind(String name,
- int defaultKind)
Returns the kind of the attribute with the given name.
Returns:
the kind of the attribute with the given name
Throws:
NoSuchElementException
- if the attribute does not exist add
Creates and adds an attribute to the set. If value is null, the method
fails silently.
Parameters:
name
- The name of the new attribute. kind
- the kind of the new attribute. value
- The value of the new attribute. If null
,
the attribute is not added. Throws:
IllegalStateException
- when there is already an attribute with
the given name in the set. add
- public void add(PkAttr attr)
Adds an attribute to the set. If the new attr has a null value, the
method fails silently.
Throws:
IllegalStateException
- if there is already an attribute with the
given name in the set. repOrAdd
Replaces the attribute with the given name, adds it if it does not
exist.
In order to preserve the class invariant (no element has a null value), if value is null the attribute is not added. Also, if the value is null and the attribute exists, it is removed.
addIfNotThere
Adds the attribute with the given name, fails silently if attribute
is already in the set or if value is null.
remove
Removes a named attribute from this set.
Returns:
the attribute that was removed from the set or null if no
attribute with the given name existed.
clear
- public void clear()
Remove all elements of the set.
toString
- public String toString()
Returns a string representation of this object.
clone
- public Object clone()
Returns a shallow copy of this object.