org.exolab.jms.net.util
Class Properties

java.lang.Object
  |
  +--org.exolab.jms.net.util.Properties

public final class Properties
extends java.lang.Object

Helper class for manipulating string property maps.

Version:
$Revision: 1.2 $ $Date: 2005/05/03 13:45:59 $
Author:
Tim Anderson

Constructor Summary
Properties(java.util.Map properties, java.lang.String prefix)
          Construct a new Properties.
Properties(java.lang.String prefix)
          Construct a new Properties.
 
Method Summary
 java.lang.String get(java.lang.String name)
          Returns the value of a property.
 boolean getBoolean(java.lang.String name, boolean defaultValue)
          Returns the value of a boolean property.
 int getInt(java.lang.String name, int defaultValue)
          Returns the value of an integer property.
 java.util.Map getProperties()
          Returns the underlying properties.
 URI getURI(java.lang.String name)
          Returns the value of an URI property.
 void set(java.lang.String name, boolean value)
          Adds a boolean property to the underlying map, as a String.
 void set(java.lang.String name, int value)
          Adds an integer property to the underlying map, as a String.
 void set(java.lang.String name, java.lang.Object value)
          Adds an object property to the underlying map, as a String.
 void set(java.lang.String name, java.lang.String value)
          Adds a property to the underlying map.
 void setNonNull(java.lang.String name, java.lang.Object value)
          Adds an object property to the underlying map, as a String, iff its value is non-null.
 void setNonNull(java.lang.String name, java.lang.String value)
          Adds a property to the underlying map, iff its value is non-null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Properties

public Properties(java.lang.String prefix)
Construct a new Properties.
Parameters:
prefix - the property name prefix. If non-null, this is prepended to unqualified property names.

Properties

public Properties(java.util.Map properties,
                  java.lang.String prefix)
Construct a new Properties.
Parameters:
properties - the properties to use. May be null
prefix - the property name prefix. If non-null, this is prepended to property names before performing lookups
Method Detail

set

public void set(java.lang.String name,
                java.lang.String value)
Adds a property to the underlying map. If the property already exists, it will be replaced.
Parameters:
name - the property name
value - the property value. May be null

setNonNull

public void setNonNull(java.lang.String name,
                       java.lang.String value)
Adds a property to the underlying map, iff its value is non-null. If the non-null, and the property already exists, it will be replaced.
Parameters:
name - the property name
value - the property value

set

public void set(java.lang.String name,
                boolean value)
Adds a boolean property to the underlying map, as a String. If the property already exists, it will be replaced.
Parameters:
name - the property name
value - the property value

set

public void set(java.lang.String name,
                int value)
Adds an integer property to the underlying map, as a String. If the property already exists, it will be replaced.
Parameters:
name - the property name
value - the property value

set

public void set(java.lang.String name,
                java.lang.Object value)
Adds an object property to the underlying map, as a String. If the property already exists, it will be replaced.
Parameters:
name - the property name
value - the property value

setNonNull

public void setNonNull(java.lang.String name,
                       java.lang.Object value)
Adds an object property to the underlying map, as a String, iff its value is non-null. If non-null, and the property already exists, it will be replaced.
Parameters:
name - the property name
value - the property value

get

public java.lang.String get(java.lang.String name)
                     throws ResourceException
Returns the value of a property.
Parameters:
name - the property name
Returns:
the corresponding value, or null if none can be found
Throws:
ResourceException - if the property isn't a string

getBoolean

public boolean getBoolean(java.lang.String name,
                          boolean defaultValue)
                   throws ResourceException
Returns the value of a boolean property.
Parameters:
name - the property name
defaultValue - the value to return if the property doesn't exist.
Returns:
the corresponding value, or defaultValue if none can be found
Throws:
ResourceException - if the property isn't a valid boolean

getInt

public int getInt(java.lang.String name,
                  int defaultValue)
           throws ResourceException
Returns the value of an integer property.
Parameters:
name - the property name
defaultValue - the value to return if the property doesn't exist.
Returns:
the corresponding value, or defaultValue if none can be found
Throws:
ResourceException - if the property isn't a valid integer

getURI

public URI getURI(java.lang.String name)
           throws ResourceException
Returns the value of an URI property.
Parameters:
name - the property name
Returns:
the corresponding URI, or null if none can be found
Throws:
ResourceException - if the URI is invalid

getProperties

public java.util.Map getProperties()
Returns the underlying properties.
Returns:
the underlying properties


Copyright © 1999-2007 The OpenJMS Group. All Rights Reserved.