org.apache.qpid.junit.extensions.util
Class ParsedProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<Object,Object>
          extended by java.util.Properties
              extended by org.apache.qpid.junit.extensions.util.ParsedProperties
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>
Direct Known Subclasses:
ContextualProperties, TestContextProperties

public class ParsedProperties
extends Properties

ParsedProperties extends the basic Properties class with methods to extract properties, not as strings but as strings parsed into basic types.

CRC Card
Responsibilities Collaborations

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
ParsedProperties()
          Creates an empty ParsedProperties.
ParsedProperties(Properties props)
          Creates a ParsedProperties initialized with the specified properties.
 
Method Summary
 boolean getPropertyAsBoolean(String propName)
          Parses a property as a boolean.
 Integer getPropertyAsInteger(String propName)
          Parses a property as an integer.
 Long getPropertyAsLong(String propName)
          Parses a property as a long.
 boolean setProperty(String propname, boolean value)
          Helper method for setting properties.
 double setProperty(String propname, double value)
          Helper method for setting properties.
 float setProperty(String propname, float value)
          Helper method for setting properties.
 int setProperty(String propname, int value)
          Helper method for setting properties.
 long setProperty(String propname, long value)
          Helper method for setting properties.
 short setProperty(String propname, short value)
          Helper method for setting properties.
 boolean setPropertyIfNull(String propname, boolean value)
          Helper method for setting properties to defaults when they are not already set.
 double setPropertyIfNull(String propname, double value)
          Helper method for setting properties to defaults when they are not already set.
 float setPropertyIfNull(String propname, float value)
          Helper method for setting properties to defaults when they are not already set.
 int setPropertyIfNull(String propname, int value)
          Helper method for setting properties to defaults when they are not already set.
 long setPropertyIfNull(String propname, long value)
          Helper method for setting properties to defaults when they are not already set.
 short setPropertyIfNull(String propname, short value)
          Helper method for setting properties to defaults when they are not already set.
 String setPropertyIfNull(String propname, String value)
          Helper method for setting properties to defaults when they are not already set.
static boolean setSysPropertyIfNull(String propname, boolean value)
          Helper method for setting system properties to defaults when they are not already set.
static double setSysPropertyIfNull(String propname, double value)
          Helper method for setting system properties to defaults when they are not already set.
static float setSysPropertyIfNull(String propname, float value)
          Helper method for setting system properties to defaults when they are not already set.
static int setSysPropertyIfNull(String propname, int value)
          Helper method for setting system properties to defaults when they are not already set.
static long setSysPropertyIfNull(String propname, long value)
          Helper method for setting system properties to defaults when they are not already set.
static short setSysPropertyIfNull(String propname, short value)
          Helper method for setting system properties to defaults when they are not already set.
static String setSysPropertyIfNull(String propname, String value)
          Helper method for setting system properties to defaults when they are not already set.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParsedProperties

public ParsedProperties()
Creates an empty ParsedProperties.


ParsedProperties

public ParsedProperties(Properties props)
Creates a ParsedProperties initialized with the specified properties.

Parameters:
props - The properties to initialize this with.
Method Detail

setSysPropertyIfNull

public static boolean setSysPropertyIfNull(String propname,
                                           boolean value)
Helper method for setting system properties to defaults when they are not already set.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

setSysPropertyIfNull

public static short setSysPropertyIfNull(String propname,
                                         short value)
Helper method for setting system properties to defaults when they are not already set.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

setSysPropertyIfNull

public static int setSysPropertyIfNull(String propname,
                                       int value)
Helper method for setting system properties to defaults when they are not already set.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

setSysPropertyIfNull

public static long setSysPropertyIfNull(String propname,
                                        long value)
Helper method for setting system properties to defaults when they are not already set.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

setSysPropertyIfNull

public static float setSysPropertyIfNull(String propname,
                                         float value)
Helper method for setting system properties to defaults when they are not already set.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

setSysPropertyIfNull

public static double setSysPropertyIfNull(String propname,
                                          double value)
Helper method for setting system properties to defaults when they are not already set.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

setSysPropertyIfNull

public static String setSysPropertyIfNull(String propname,
                                          String value)
Helper method for setting system properties to defaults when they are not already set.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the system property after this method call.

setPropertyIfNull

public boolean setPropertyIfNull(String propname,
                                 boolean value)
Helper method for setting properties to defaults when they are not already set.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

setPropertyIfNull

public short setPropertyIfNull(String propname,
                               short value)
Helper method for setting properties to defaults when they are not already set.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

setPropertyIfNull

public int setPropertyIfNull(String propname,
                             int value)
Helper method for setting properties to defaults when they are not already set.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

setPropertyIfNull

public long setPropertyIfNull(String propname,
                              long value)
Helper method for setting properties to defaults when they are not already set.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

setPropertyIfNull

public float setPropertyIfNull(String propname,
                               float value)
Helper method for setting properties to defaults when they are not already set.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

setPropertyIfNull

public double setPropertyIfNull(String propname,
                                double value)
Helper method for setting properties to defaults when they are not already set.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

setPropertyIfNull

public String setPropertyIfNull(String propname,
                                String value)
Helper method for setting properties to defaults when they are not already set.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

setProperty

public boolean setProperty(String propname,
                           boolean value)
Helper method for setting properties.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

setProperty

public short setProperty(String propname,
                         short value)
Helper method for setting properties.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

setProperty

public int setProperty(String propname,
                       int value)
Helper method for setting properties.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

setProperty

public long setProperty(String propname,
                        long value)
Helper method for setting properties.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

setProperty

public float setProperty(String propname,
                         float value)
Helper method for setting properties.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

setProperty

public double setProperty(String propname,
                          double value)
Helper method for setting properties.

Parameters:
propname - The name of the system property to set.
value - The value to set it to.
Returns:
The value of the property after this method call.

getPropertyAsBoolean

public boolean getPropertyAsBoolean(String propName)
Parses a property as a boolean.

Parameters:
propName - The property.
Returns:
The property as a boolean, or false if it does not exist.

getPropertyAsInteger

public Integer getPropertyAsInteger(String propName)
Parses a property as an integer.

Parameters:
propName - The property.
Returns:
The property as a integer, or null if it does not exist.

getPropertyAsLong

public Long getPropertyAsLong(String propName)
Parses a property as a long.

Parameters:
propName - The property.
Returns:
The property as a long, or null if it does not exist.


Licensed to the Apache Software Foundation