org.qedeq.kernel.xml.handler.common
Class SimpleAttributes

java.lang.Object
  extended by org.qedeq.kernel.xml.handler.common.SimpleAttributes

public class SimpleAttributes
extends java.lang.Object

Value object that contains unsorted key value pairs. Both arguments are string type, but there are access methods for different data types. If the type conversion in not possible an appropriate RuntimeException is thrown.

With add(java.lang.String, java.lang.String) another key value pair is added. An IllegalArgumentException is thrown, if the key is already known.

Author:
Michael Meyling

Constructor Summary
SimpleAttributes()
           
 
Method Summary
 void add(java.lang.String key, java.lang.String value)
          Adds a key value pair.
 java.lang.Boolean getBoolean(java.lang.String key)
          Returns the value for a key as an Boolean.
 java.util.Date getDate(java.lang.String key)
          Returns the value for a key as an Date.
 java.lang.Integer getInteger(java.lang.String key)
          Returns the value for a key as an Integer.
 java.lang.String[] getKeySortedStringValues()
          Get the attribute values, sorted by their keys.
 java.lang.String getString(java.lang.String key)
          Returns the value for a key.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleAttributes

public SimpleAttributes()
Method Detail

add

public final void add(java.lang.String key,
                      java.lang.String value)
Adds a key value pair. This key must be still unknown.

Parameters:
key - Key.
value - Value, maybe null.

getString

public final java.lang.String getString(java.lang.String key)
Returns the value for a key. If the key dosn't exist null is returned.

Parameters:
key - Key.
Returns:
Associated value.

getInteger

public final java.lang.Integer getInteger(java.lang.String key)
Returns the value for a key as an Integer. If the key dosn't exist null is returned. If the value must be transformable into an Integer value.

Parameters:
key - Key.
Returns:
Associated value converted into an Integer.

getBoolean

public final java.lang.Boolean getBoolean(java.lang.String key)
Returns the value for a key as an Boolean. If the key dosn't exist null is returned. If the value must be transformable into an Boolean value.

Parameters:
key - Key.
Returns:
Associated value converted into an Boolean.

getDate

public final java.util.Date getDate(java.lang.String key)
Returns the value for a key as an Date. If the key dosn't exist null is returned. If the value must be transformable into an Date value. The expected date format is "yyyy-MM-dd'T'HH:mm:ss".

Parameters:
key - Key.
Returns:
Associated value converted into an Date.

getKeySortedStringValues

public final java.lang.String[] getKeySortedStringValues()
Get the attribute values, sorted by their keys.

Returns:
Key sorted string values.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2014. All Rights Reserved.