|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectariba.util.core.PropertyTable
public class PropertyTable
PropertyTable
is an extension of a Map
which provides additional convenience methods and some minor semantic
changes. For example, calling the setPropertyForKey
method
with a null value removes the value for the given key from the
PropertyTable
. There are also convenience methods for
returning a property as a particular type; if the value stored in the
PropertyTable
is of a different type, a reasonable conversion
is done. Finally, it is possible to store a null in a property table
using a special object to represent that.
Field Summary | |
---|---|
static java.lang.String |
NullValueMarker
A special object that represent a null value stored in a PropertyTable . |
Constructor Summary | |
---|---|
PropertyTable()
Creates a new empty PropertyTable . |
|
PropertyTable(java.util.Map properties)
Creates a new PropertyTable from the given
Map of properties. |
Method Summary | |
---|---|
boolean |
booleanPropertyForKey(java.lang.String key)
Return the property for the given key as a boolean . |
boolean |
containsKey(java.lang.String key)
Returns whether the table contains a value for the given key. |
java.lang.Object |
debugState()
Returns an object that will be toStringed when the debug information needs to be printed. |
double |
doublePropertyForKey(java.lang.String key)
Return the property for the given key as a double . |
java.util.Iterator |
getAllProperties()
Return an Iterator of all the properties stored in
this table. |
int |
getCount()
Return the number of properties in the table. |
java.util.Map |
getProperties()
Returns the properties stored in this table as a Map . |
java.lang.Object |
getPropertyForKey(java.lang.String key)
Return the property for the given key. |
int |
integerPropertyForKey(java.lang.String key)
Return the property for the given key as an int . |
void |
setPropertyForKey(java.lang.String key,
java.lang.Object value)
Sets a property value for the given key. |
java.lang.String |
stringPropertyForKey(java.lang.String key)
Return the property for the given key as a string. |
java.lang.String |
toString()
Returns a string reprsentation of this table of properties. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String NullValueMarker
PropertyTable
.
Constructor Detail |
---|
public PropertyTable()
PropertyTable
.
public PropertyTable(java.util.Map properties)
PropertyTable
from the given
Map
of properties.
properties
- the properties to store in this tableMethod Detail |
---|
public java.util.Map getProperties()
Map
.
Map
of propertiespublic java.util.Iterator getAllProperties()
Iterator
of all the properties stored in
this table.
Iterator
of the properties in this tablepublic java.lang.Object getPropertyForKey(java.lang.String key)
NullValueMarker
.
key
- the key for the property to retrieve
public void setPropertyForKey(java.lang.String key, java.lang.Object value)
key
- the key under which to store the valuevalue
- the new value, or null to remove the current valuepublic java.lang.String stringPropertyForKey(java.lang.String key)
toString
method is called on the value. Returns null if the given key is null.
key
- the key for the property to retrieve
public boolean booleanPropertyForKey(java.lang.String key)
boolean
. If
the current value for the property is not a boolean, the value is
converted using the booleanValue
method from the
Util
class. Returns null if the given key is null.
key
- the key for the property to retrieve
public int integerPropertyForKey(java.lang.String key)
int
. If the
current value for the property is not an integer, the value is
converted using the intValue
method from the
Util
class. Returns null if the given key is null.
key
- the key for the property to retrieve
public double doublePropertyForKey(java.lang.String key)
double
. If
the current value for the property is not a double, the value is
converted using the doubleValue
method from the
Util
class. Returns null if the given key is null.
key
- the key for the property to retrieve
public int getCount()
public boolean containsKey(java.lang.String key)
NullValueMarker
, this method
will return true.
key
- the key for the property to test
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object debugState()
debugState
in interface DebugState
ThreadDebugState.set(ariba.util.core.ThreadDebugKey, java.lang.Object)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |