com.continuent.tungsten.common.config
Class TungstenProperties

java.lang.Object
  extended by com.continuent.tungsten.common.config.TungstenProperties
All Implemented Interfaces:
java.io.Serializable

public class TungstenProperties
extends java.lang.Object
implements java.io.Serializable

Defines a simple HashMap wrapper that can be used to store and retrieve properties using typed getters and setters. There is support for serializing to and from Java properties format, setting variables, merging properties, and other niceties.

Version:
1.0
Author:
Robert Hodges
See Also:
Serialized Form

Field Summary
static java.lang.String ENDOFLINE_TAG
           
static java.lang.String ENDOFPROPERTIES_TAG
           
protected  java.util.Map<java.lang.String,java.lang.Object> properties
           
 
Constructor Summary
TungstenProperties()
          Creates a new instance.
TungstenProperties(boolean sorted)
          Creates a new instance with sorting.
TungstenProperties(java.util.Map<java.lang.String,java.lang.String> map)
          Creates a new instance from an existing map.
 
Method Summary
 void add(java.io.InputStream is)
          Loads values from Java properties file format with variable substitutions.
 void add(java.io.InputStream is, boolean doSubstitutions)
          Adds values from Java properties file format.
 void add(java.util.Properties props)
          Load values from a Properties instance.
 java.util.Map<java.lang.String,java.lang.Object> any()
           
 void applyProperties(java.lang.Object o)
          Applies the current properties to the given object, stopping and throwing errors if a property has no matching setter in the given object.
 void applyProperties(java.lang.Object o, boolean ignoreIfMissing)
          Applies the properties in the TungstenProperties object to corresponding properties on a Java object by matching property names to setter methods on the object.
 void clear()
          Clears all property values so that the underlying map is empty.
 boolean containsKey(java.lang.String key)
          Returns true if the indicated property key exists.
static TungstenProperties createFromStream(java.io.BufferedReader in)
          Receives properties from given stream.
This function uses a in-house protocol consisting in having, for each key/value pair, 1 line for key, 1 line for the class name and 1 for value.
 boolean equals(java.lang.Object o)
          Returns true if the argument contains exactly the same property values as this properties instance.
 void extractProperties(java.lang.Object o, boolean ignoreIfUnsupported)
          Create a set of initialized properties from the set of fields in a specific object instance.
static java.lang.String formatProperties(java.lang.String name, TungstenProperties props, java.lang.String header)
           
 java.lang.String get(java.lang.String key)
           
 boolean getBoolean(java.lang.String key)
           
 boolean getBoolean(java.lang.String key, java.lang.String defaultValue, boolean required)
           
 java.util.Map<java.lang.String,java.util.Map<java.lang.String,TungstenProperties>> getClusterMap()
          Retrieves a cluster map as stored by setClusterMap(Map)
 java.util.Map<java.lang.String,TungstenProperties> getDataSourceMap()
          Retrieves a data source map as stored by setDataSourceMap(Map)
 java.util.Date getDate(java.lang.String key)
           
 java.util.Date getDate(java.lang.String key, java.lang.String defaultValue, boolean required)
           
 double getDouble(java.lang.String key)
           
 double getDouble(java.lang.String key, java.lang.String defaultValue, boolean required)
           
 java.io.File getFile(java.lang.String key)
           
 java.io.File getFile(java.lang.String key, java.lang.String defaultValue, boolean required)
           
 float getFloat(java.lang.String key)
           
 float getFloat(java.lang.String key, java.lang.String defaultValue, boolean required)
           
 int getInt(java.lang.String key)
           
 int getInt(java.lang.String key, java.lang.String defaultValue, boolean required)
           
 Interval getInterval(java.lang.String key)
          Returns an interval value.
 Interval getInterval(java.lang.String key, java.lang.String defaultValue, boolean required)
          Returns an interval or the default value.
 long getLong(java.lang.String key)
           
 long getLong(java.lang.String key, java.lang.String defaultValue, boolean required)
           
 java.lang.Object getObject(java.lang.String key)
           
 java.lang.Object getObject(java.lang.String key, java.lang.Object defaultValue, boolean required)
          Given a key, gets the object
 java.util.Properties getProperties()
          Get an instances of Properties that is populated by the current values of the instance on which it's called.
 java.lang.String getProperty(java.lang.String key)
           
 java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
           
 java.lang.String getString(java.lang.String key)
           
 java.lang.String getString(java.lang.String key, java.lang.String defaultValue, boolean required)
          Returns the value as a String with an optional default value and checking to ensure value is present if required
 java.util.List<java.lang.String> getStringList(java.lang.String key)
          Returns a list of strings from a value containing a list of string values separated by commas or whitespace characters.
 TungstenProperties getTungstenProperties(java.lang.String key)
          Returns a TungstenProperties value.
 java.util.HashMap<java.lang.String,java.lang.String> hashMap()
          Returns a shallow copy of the underlying map as a HashMap.
 boolean isBean(java.lang.Class<?> clazz)
          Returns true if the class in question is supports JavaBean conventions by having a default constructor and setters/getters for properties.
 boolean isBeanSupportEnabled()
          Returns true if this instance supports extracting/setting bean properties.
 boolean isEmpty()
          Returns true if properties map is empty.
 java.util.Set<java.lang.String> keyNames()
          Returns keys of all properties currently stored in this instance.
 java.util.Set<java.lang.String> keyNames(java.lang.String prefix)
          Returns keys of all properties where the key name matches the provided prefix.
static java.lang.String listToString(java.util.List<java.lang.String> list)
          TODO: listToString definition.
 void load(java.io.InputStream is)
          Loads values from Java properties file format with variable substitutions.
 void load(java.io.InputStream is, boolean doSubstitutions)
          Loads values from Java properties file format.
 void load(java.util.Properties props)
          Load values from a Properties instance.
 void load(java.lang.String nameValuePairs, boolean doSubstitutions)
          Loads values from a string of name-value pairs of the form a=1;b=2;...;z=N.
static TungstenProperties loadFromJSON(java.lang.String json)
          Load values from a JSON serialized string
 java.util.Map<java.lang.String,java.lang.String> map()
          Returns a shallow copy of the underlying map as a generic Map.
 void put(java.lang.Object key, java.lang.Object value)
           
 void put(java.lang.String key, java.lang.String value)
          Utility method to help with compatibility with Properties
 void putAll(TungstenProperties props)
          Merges the properties provided as an argument with these properties, overriding current values wherever there are overlaps.
 void putAllWithPrefix(TungstenProperties props, java.lang.String prefix)
          Prefixes all the given properties with the given string and merges this new set with the actual ones, overriding current values with same keys if any
 java.lang.String remove(java.lang.String key)
          Removes the property indicated by the key, if it exists, and returns the value.
 void send(java.io.PrintWriter out)
          Sends this object's set of properties on the given stream.
 void set(java.lang.String name, java.lang.Object value)
           
 void setBeanSupportEnabled(boolean beanSupportEnabled)
          If set to true this instance will support extracting/setting bean properties.
 void setBoolean(java.lang.String key, boolean value)
           
 void setClusterMap(java.util.Map<java.lang.String,java.util.Map<java.lang.String,TungstenProperties>> map)
          Stores a Map which keys are strings and values are Maps of String/TungstenProperties.
 void setDataSourceMap(java.util.Map<java.lang.String,TungstenProperties> map)
          Stores a Map which keys are strings and values are TungstenProperties.
 void setDate(java.lang.String key, java.util.Date value)
          Date type is stored as a long representing the number of milliseconds since January 1, 1970, 00:00:00 GMT as retrieved by Date.getTime()
 void setDouble(java.lang.String key, double value)
           
 void setFile(java.lang.String key, java.io.File value)
           
 void setFloat(java.lang.String key, float value)
           
 void setInt(java.lang.String key, int value)
           
 void setInterval(java.lang.String key, Interval value)
          Stores a time interval provided as an object by converting to an interval instance.
 void setInterval(java.lang.String key, java.lang.Long value)
          Stores a time interval provided in milliseconds, which is the base representation.
 void setLong(java.lang.String key, long value)
           
 void setObject(java.lang.String key, java.lang.Object value)
          Sets the property value from an object using its toString() method.
 void setProperty(java.lang.String key, java.lang.String value)
          Utility method to help with compatibility with Properties
 void setString(java.lang.String key, java.lang.String value)
          Sets the value as a string.
 void setStringList(java.lang.String key, java.util.List<java.lang.String> list)
          Sets a value from a String list.
 void setTungstenProperties(java.lang.String key, TungstenProperties tungstenProperties)
          Stores a TungstenProperties as a property
 int size()
          Returns the number of properties in this instance.
 void store(java.io.OutputStream os)
          Stores values in Java properties file format.
 TungstenProperties subset(java.lang.String prefix, boolean removePrefix)
          Returns a TungstenProperties instance consisting of the property names that match the given prefix
 TungstenProperties subset(java.lang.String prefix, boolean removePrefix, boolean removeProps)
          Returns a TungstenProperties instance consisting of the property names that match the given prefix
static int substituteSystemValues(java.util.Properties props)
          Scan Properties instance values replacing any expression of the form ${name} where 'name' is a key in System.properties *or* a local property in the same file, where local property substitutions take priority over system property names.
static int substituteSystemValues(java.util.Properties props, int iterations)
          Substitute system values up to a certain number of times.
 java.lang.String toJSON()
           
 java.lang.String toJSON(boolean prettyPrint)
          Serialize the TungstenProperties into a JSON String
 java.lang.String toNameValuePairs()
          Returns values as a string of name/value pairs that can be loaded using load(String, boolean).
 java.lang.String toString()
          Returns toString of underlying properties rather than wrapper.
 void trim()
          Trims all property values to remove leading and trailing whitespace.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ENDOFPROPERTIES_TAG

public static final java.lang.String ENDOFPROPERTIES_TAG
See Also:
Constant Field Values

ENDOFLINE_TAG

public static final java.lang.String ENDOFLINE_TAG
See Also:
Constant Field Values

properties

protected java.util.Map<java.lang.String,java.lang.Object> properties
Constructor Detail

TungstenProperties

public TungstenProperties()
Creates a new instance.


TungstenProperties

public TungstenProperties(java.util.Map<java.lang.String,java.lang.String> map)
Creates a new instance from an existing map.


TungstenProperties

public TungstenProperties(boolean sorted)
Creates a new instance with sorting.

Method Detail

any

public java.util.Map<java.lang.String,java.lang.Object> any()

set

public void set(java.lang.String name,
                java.lang.Object value)

isBeanSupportEnabled

public boolean isBeanSupportEnabled()
Returns true if this instance supports extracting/setting bean properties.


setBeanSupportEnabled

public void setBeanSupportEnabled(boolean beanSupportEnabled)
If set to true this instance will support extracting/setting bean properties.

Parameters:
beanSupportEnabled -

load

public void load(java.io.InputStream is)
          throws java.io.IOException
Loads values from Java properties file format with variable substitutions.

Throws:
java.io.IOException

load

public void load(java.io.InputStream is,
                 boolean doSubstitutions)
          throws java.io.IOException
Loads values from Java properties file format. Current values are obliterated.

Parameters:
is - InputStream containing properties.
doSubstitutions - If true perform variable substitutions
Throws:
java.io.IOException

load

public void load(java.lang.String nameValuePairs,
                 boolean doSubstitutions)
Loads values from a string of name-value pairs of the form a=1;b=2;...;z=N. White space is ignored.


loadFromJSON

public static TungstenProperties loadFromJSON(java.lang.String json)
                                       throws org.codehaus.jackson.JsonParseException,
                                              org.codehaus.jackson.map.JsonMappingException,
                                              java.io.IOException
Load values from a JSON serialized string

Parameters:
json - The JSON serialized string
Throws:
org.codehaus.jackson.JsonParseException
org.codehaus.jackson.map.JsonMappingException
java.io.IOException

getProperties

public java.util.Properties getProperties()
Get an instances of Properties that is populated by the current values of the instance on which it's called.

Returns:
Properties

load

public void load(java.util.Properties props)
Load values from a Properties instance. Current values are obliterated.


substituteSystemValues

public static int substituteSystemValues(java.util.Properties props,
                                         int iterations)
Substitute system values up to a certain number of times. This permits clients to reuse variables to get multiple substitutions without running into problems with infinite loops.


substituteSystemValues

public static int substituteSystemValues(java.util.Properties props)
Scan Properties instance values replacing any expression of the form ${name} where 'name' is a key in System.properties *or* a local property in the same file, where local property substitutions take priority over system property names. If there is no such value the expression is left as is.


store

public void store(java.io.OutputStream os)
           throws java.io.IOException
Stores values in Java properties file format. This does not work for embedded lists.

Throws:
java.io.IOException

applyProperties

public void applyProperties(java.lang.Object o)
Applies the current properties to the given object, stopping and throwing errors if a property has no matching setter in the given object. This is equivalent to applyProperties(o, false)

Parameters:
o - instance on which to set properties

applyProperties

public void applyProperties(java.lang.Object o,
                            boolean ignoreIfMissing)
Applies the properties in the TungstenProperties object to corresponding properties on a Java object by matching property names to setter methods on the object. Here are the rules for matching.
  1. The first letter of the property is capitalized, so foo_bar becomes Foo_bar.
  2. If an underscore ("_") occurs in the property name, it is omitted and the following character, if any, is capitalized. Foo_bar becomes FooBar.
  3. The prefix "set" is added to the result. FooBar becomes setFooBar.
The setter method, if found, must have a single argument and must be publicly accessible. Multiple setters that differ only by argument type are not supported.

Parameters:
o - Instance for which we are to set properties
ignoreIfMissing - whether or not stop and throw an error if a property has no matching setting in the given object instance
Throws:
PropertyException - Thrown if we cannot find a setter for a property or if invocation of the setter fails

extractProperties

public void extractProperties(java.lang.Object o,
                              boolean ignoreIfUnsupported)
Create a set of initialized properties from the set of fields in a specific object instance.

Parameters:
o -
ignoreIfUnsupported -

trim

public void trim()
Trims all property values to remove leading and trailing whitespace.


remove

public java.lang.String remove(java.lang.String key)
Removes the property indicated by the key, if it exists, and returns the value.


clear

public void clear()
Clears all property values so that the underlying map is empty.


isEmpty

public boolean isEmpty()
Returns true if properties map is empty.


keyNames

public java.util.Set<java.lang.String> keyNames()
Returns keys of all properties currently stored in this instance.


keyNames

public java.util.Set<java.lang.String> keyNames(java.lang.String prefix)
Returns keys of all properties where the key name matches the provided prefix.


containsKey

public boolean containsKey(java.lang.String key)
Returns true if the indicated property key exists. This method returns true even if the property is set to null.


size

public int size()
Returns the number of properties in this instance.


putAll

public void putAll(TungstenProperties props)
Merges the properties provided as an argument with these properties, overriding current values wherever there are overlaps.


putAllWithPrefix

public void putAllWithPrefix(TungstenProperties props,
                             java.lang.String prefix)
Prefixes all the given properties with the given string and merges this new set with the actual ones, overriding current values with same keys if any


setString

public void setString(java.lang.String key,
                      java.lang.String value)
Sets the value as a string.


setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)
Utility method to help with compatibility with Properties

Parameters:
key -
value -

put

public void put(java.lang.Object key,
                java.lang.Object value)

put

public void put(java.lang.String key,
                java.lang.String value)
Utility method to help with compatibility with Properties

Parameters:
key -
value -

setObject

public void setObject(java.lang.String key,
                      java.lang.Object value)
Sets the property value from an object using its toString() method.


setInt

public void setInt(java.lang.String key,
                   int value)

setLong

public void setLong(java.lang.String key,
                    long value)

setFloat

public void setFloat(java.lang.String key,
                     float value)

setDouble

public void setDouble(java.lang.String key,
                      double value)

setBoolean

public void setBoolean(java.lang.String key,
                       boolean value)

setFile

public void setFile(java.lang.String key,
                    java.io.File value)

setDate

public void setDate(java.lang.String key,
                    java.util.Date value)
Date type is stored as a long representing the number of milliseconds since January 1, 1970, 00:00:00 GMT as retrieved by Date.getTime()

Parameters:
key - unique identifier for this property
value - the date to store

setStringList

public void setStringList(java.lang.String key,
                          java.util.List<java.lang.String> list)
Sets a value from a String list. This results in a series of comma-separated values that can be read with getStringList(String).


setInterval

public void setInterval(java.lang.String key,
                        java.lang.Long value)
Stores a time interval provided in milliseconds, which is the base representation.


setInterval

public void setInterval(java.lang.String key,
                        Interval value)
Stores a time interval provided as an object by converting to an interval instance.


setTungstenProperties

public void setTungstenProperties(java.lang.String key,
                                  TungstenProperties tungstenProperties)
Stores a TungstenProperties as a property

Parameters:
key - the key to identify the property
tungstenProperties - the TungstenProperties to store

setDataSourceMap

public void setDataSourceMap(java.util.Map<java.lang.String,TungstenProperties> map)
Stores a Map which keys are strings and values are TungstenProperties. This function is meant to be used to store a data source map

Each TungstenProperties entry in the given map will be stored in this object with its keys prefixed by the corresponding map key + its own key, separated by MAP_KEY_SEPARATOR

Note that none of the TungstenProperties in the given map can be null

Parameters:
map - the map to store

setClusterMap

public void setClusterMap(java.util.Map<java.lang.String,java.util.Map<java.lang.String,TungstenProperties>> map)
Stores a Map which keys are strings and values are Maps of String/TungstenProperties. This function is meant to be used to store a cluster map

Each entry in the given map will be stored in this object with its keys prefixed by the corresponding map key + MAP_KEY_SEPARATOR + its own key + MAP_KEY_SEPARATOR + its Tungsten properties key.

Note that none of the TungstenProperties in the given map can be null

Parameters:
map - the map to store

getObject

public java.lang.Object getObject(java.lang.String key,
                                  java.lang.Object defaultValue,
                                  boolean required)
Given a key, gets the object

Parameters:
key -
defaultValue -
required -
Returns:
Object

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.String defaultValue,
                                  boolean required)
Returns the value as a String with an optional default value and checking to ensure value is present if required

Parameters:
key - The name of the property
defaultValue - An optional default value
required - If true, a value or default must be present
Returns:
The corresponding value or null if not found and no default exists
Throws:
PropertyException - if the value is required but does not exist

getString

public java.lang.String getString(java.lang.String key)

getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String defaultValue)

getProperty

public java.lang.String getProperty(java.lang.String key)

get

public java.lang.String get(java.lang.String key)

getObject

public java.lang.Object getObject(java.lang.String key)

getInt

public int getInt(java.lang.String key)

getInt

public int getInt(java.lang.String key,
                  java.lang.String defaultValue,
                  boolean required)

getLong

public long getLong(java.lang.String key)

getLong

public long getLong(java.lang.String key,
                    java.lang.String defaultValue,
                    boolean required)

getFloat

public float getFloat(java.lang.String key)

getFloat

public float getFloat(java.lang.String key,
                      java.lang.String defaultValue,
                      boolean required)

getDouble

public double getDouble(java.lang.String key)

getDouble

public double getDouble(java.lang.String key,
                        java.lang.String defaultValue,
                        boolean required)

getBoolean

public boolean getBoolean(java.lang.String key)

getBoolean

public boolean getBoolean(java.lang.String key,
                          java.lang.String defaultValue,
                          boolean required)

getFile

public java.io.File getFile(java.lang.String key)

getFile

public java.io.File getFile(java.lang.String key,
                            java.lang.String defaultValue,
                            boolean required)

getDate

public java.util.Date getDate(java.lang.String key,
                              java.lang.String defaultValue,
                              boolean required)

getDate

public java.util.Date getDate(java.lang.String key)

getStringList

public java.util.List<java.lang.String> getStringList(java.lang.String key)
Returns a list of strings from a value containing a list of string values separated by commas or whitespace characters. Here are some examples:


getInterval

public Interval getInterval(java.lang.String key,
                            java.lang.String defaultValue,
                            boolean required)
Returns an interval or the default value.


getInterval

public Interval getInterval(java.lang.String key)
Returns an interval value.


getTungstenProperties

public TungstenProperties getTungstenProperties(java.lang.String key)
Returns a TungstenProperties value.

Parameters:
key - identifying the property
Returns:
TungstenProperties

getDataSourceMap

public java.util.Map<java.lang.String,TungstenProperties> getDataSourceMap()
Retrieves a data source map as stored by setDataSourceMap(Map)

Returns:
a String/TungstenProperties map

getClusterMap

public java.util.Map<java.lang.String,java.util.Map<java.lang.String,TungstenProperties>> getClusterMap()
Retrieves a cluster map as stored by setClusterMap(Map)

Returns:
a String/(String/TungstenProperties) map

map

public java.util.Map<java.lang.String,java.lang.String> map()
Returns a shallow copy of the underlying map as a generic Map.


hashMap

public java.util.HashMap<java.lang.String,java.lang.String> hashMap()
Returns a shallow copy of the underlying map as a HashMap.


toNameValuePairs

public java.lang.String toNameValuePairs()
Returns values as a string of name/value pairs that can be loaded using load(String, boolean).


subset

public TungstenProperties subset(java.lang.String prefix,
                                 boolean removePrefix)
Returns a TungstenProperties instance consisting of the property names that match the given prefix

Parameters:
prefix - Return only those properties that match the prefix
removePrefix - If true remove the prefix from each property name

subset

public TungstenProperties subset(java.lang.String prefix,
                                 boolean removePrefix,
                                 boolean removeProps)
Returns a TungstenProperties instance consisting of the property names that match the given prefix

Parameters:
prefix - Return only those properties that match the prefix
removePrefix - If true remove the prefix from each property name
removeProps - If true remove the matching key/value pairs from these properties

equals

public boolean equals(java.lang.Object o)
Returns true if the argument contains exactly the same property values as this properties instance.

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Returns toString of underlying properties rather than wrapper.

Overrides:
toString in class java.lang.Object

toJSON

public java.lang.String toJSON()
                        throws org.codehaus.jackson.JsonGenerationException,
                               org.codehaus.jackson.map.JsonMappingException,
                               java.io.IOException
Throws:
org.codehaus.jackson.JsonGenerationException
org.codehaus.jackson.map.JsonMappingException
java.io.IOException

toJSON

public java.lang.String toJSON(boolean prettyPrint)
                        throws org.codehaus.jackson.JsonGenerationException,
                               org.codehaus.jackson.map.JsonMappingException,
                               java.io.IOException
Serialize the TungstenProperties into a JSON String

Parameters:
prettyPrint - Set to true to have the JSON output formatted for easier read
Returns:
String representing JSON serialization of the TungstenProperties
Throws:
org.codehaus.jackson.JsonGenerationException
org.codehaus.jackson.map.JsonMappingException
java.io.IOException

formatProperties

public static java.lang.String formatProperties(java.lang.String name,
                                                TungstenProperties props,
                                                java.lang.String header)

createFromStream

public static TungstenProperties createFromStream(java.io.BufferedReader in)
                                           throws java.io.IOException
Receives properties from given stream.
This function uses a in-house protocol consisting in having, for each key/value pair, 1 line for key, 1 line for the class name and 1 for value. The end of the transmission is identified by a predefined key name "#EOF"

Parameters:
in - a ready-to-be-read buffered reader from which to get properties
Returns:
a new set of properties containing data read on the stream
Throws:
java.io.IOException - upon error while reading on the given input stream, or if no data can be read at all
java.lang.ClassNotFoundException
java.lang.NoSuchMethodException
java.lang.SecurityException
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.IllegalArgumentException
See Also:
send(PrintWriter)

send

public void send(java.io.PrintWriter out)
Sends this object's set of properties on the given stream.
This function uses a in-house protocol consisting in having, for each key/value pair, 1 line for key an 1 for value. The end of the transmission is identified by a predefined key name "#EOF"

Parameters:
out - a prepared PrintWriter output stream on which to send properties
See Also:
createFromStream(BufferedReader)

isBean

public boolean isBean(java.lang.Class<?> clazz)
Returns true if the class in question is supports JavaBean conventions by having a default constructor and setters/getters for properties.


listToString

public static java.lang.String listToString(java.util.List<java.lang.String> list)
TODO: listToString definition.


add

public void add(java.io.InputStream is)
         throws java.io.IOException
Loads values from Java properties file format with variable substitutions.

Throws:
java.io.IOException

add

public void add(java.io.InputStream is,
                boolean doSubstitutions)
         throws java.io.IOException
Adds values from Java properties file format. Current values are kept except if it exists in the stream, in which case it is overwritten.

Parameters:
is - InputStream containing properties.
doSubstitutions - If true perform variable substitutions
Throws:
java.io.IOException

add

public void add(java.util.Properties props)
Load values from a Properties instance. Current values are replaced only if they are in the source map.