com.ibm.security.certclient.base

Class PkAttrs

  1. java.lang.Object
  2. extended bycom.ibm.security.certclient.base.PkAttrs
All implemented interfaces:
Serializable, Cloneable

  1. public final class PkAttrs
  2. extends Object
  3. implements Serializable, Cloneable
A set of PkAttrs.

This class implements most of the methods defined for Collection, but instead of using Objects 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:
Serialized Form

Nested Class Summary

Modifier and Type Class and Description
  1. class
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
  1. void
add(PkAttr attr)
Adds an attribute to the set.
  1. void
add(String name,int kind,Object value)
Creates and adds an attribute to the set.
  1. void
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.
  1. void
clear()
Remove all elements of the set.
  1. Object
clone()
Returns a shallow copy of this object.
  1. PkAttr
get(String name)
Returns the attribute with the given name.
  1. PkAttr
get(String name,PkAttr defaultAttr)
Returns the attribute with the given name.
  1. int
getKind(String name)
Returns the kind of the attribute with the given name.
  1. int
getKind(String name,int defaultKind)
Returns the kind of the attribute with the given name.
  1. String
getString(String name)
Returns the value of the attribute with the given name as a String.
  1. String
getString(String name,String defaultValue)
Returns the value of the attribute with the given name as a String.
  1. String
getStringIgnoreCase(String name)
Returns the value of the attribute with the given name as a String.
  1. String
getStringIgnoreCase(String name,String defaultValue)
Returns the value of the attribute with the given name as a String.
  1. Object
getValue(String name)
Returns the value of the attribute with the given name.
  1. Object
getValue(String name,Object defaultValue)
Returns the value of the attribute with the given name.
  1. Object
getValueIgnoreCase(String name)
Returns the value of the attribute with the given name.
  1. Object
getValueIgnoreCase(String name,Object defaultValue)
Returns the value of the attribute with the given name.
  1. boolean
has(String name)
Returns true if and only if the attribute with the given name is in the set.
  1. boolean
isEmpty()
Returns true if and only if the set of attributes is not empty.
  1. PkAttrs.Iter
iterator()
  1. PkAttr
remove(String name)
Removes a named attribute from this set.
  1. void
repOrAdd(String name,int kind,Object value)
Replaces the attribute with the given name, adds it if it does not exist.
  1. int
size()
Returns the number of attributes in the set.
  1. String
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

  1. public PkAttrs()
Construct an empty set of attributes.

Method Detail

size

  1. public int size()
Returns the number of attributes in the set.

isEmpty

  1. public boolean isEmpty()
Returns true if and only if the set of attributes is not empty.

iterator

  1. public PkAttrs.Iter iterator()

has

  1. public boolean has(String name)
Returns true if and only if the attribute with the given name is in the set.

get

  1. public PkAttr get(String name)
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

  1. public PkAttr get(String name,
  2. PkAttr defaultAttr)
Returns the attribute with the given name.
Returns:
the attribute with the given name or defaultAttr if not found.

getValue

  1. public Object getValue(String name)
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

  1. public Object getValue(String name,
  2. Object defaultValue)
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

  1. public String getString(String name)
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

  1. public String getString(String name,
  2. String defaultValue)
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

  1. public Object getValueIgnoreCase( String name)
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

  1. public Object getValueIgnoreCase( String name,
  2. Object defaultValue)
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

  1. public String getStringIgnoreCase( String name)
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

  1. public String getStringIgnoreCase( String name,
  2. String defaultValue)
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

  1. 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

  1. public int getKind(String name,
  2. 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

  1. public void add(String name,
  2. int kind,
  3. Object value)
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

  1. 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

  1. public void repOrAdd(String name,
  2. int kind,
  3. Object value)
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

  1. public void addIfNotThere(String name,
  2. int kind,
  3. Object value)
Adds the attribute with the given name, fails silently if attribute is already in the set or if value is null.

remove

  1. public PkAttr remove(String name)
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

  1. public void clear()
Remove all elements of the set.

toString

  1. public String toString()
Returns a string representation of this object.
Overrides:
toString in class Object

clone

  1. public Object clone()
Returns a shallow copy of this object.
Overrides:
clone in class Object