jp.go.aist.rtm.RTC.util
Class Properties

java.lang.Object
  extended by jp.go.aist.rtm.RTC.util.Properties

public class Properties
extends java.lang.Object

Property set that consists of key and value

Can keep in the stream, and load it from the stream. The key to each property and the value corresponding to it are character. When default can be specified for the property set, and the key specified by former property set is not found, this second property set is retrieved.


Constructor Summary
Properties()
           Default constructor
Properties(java.util.Map<java.lang.String,java.lang.String> defaults)
           Constructor
Properties(Properties prop)
           Cpoy constructor
Properties(java.lang.String key)
           Constructor
Properties(java.lang.String[] defaults)
           Constructor
Properties(java.lang.String key, java.lang.String value)
           Constructor
 
Method Summary
protected  java.io.OutputStream _dump(java.io.OutputStream out, Properties curr, int index)
           
 java.lang.String _dump(java.lang.String out, Properties curr, int index)
           makes the content of Properties a character string.
protected  Properties _getNode(java.util.Vector<java.lang.String> keys, int index, Properties curr)
           
protected  void _propertyNames(java.util.Vector<java.lang.String> names, java.lang.String curr_name, Properties curr)
           
protected  void _store(java.io.OutputStream out, java.lang.String curr_name, Properties curr)
           
 void clear()
           Deletes all his child nodes.
 boolean createNode(java.lang.String key)
           makes the child node the Properties object of the specified key.
 void destruct()
           Destructor processing
protected  void finalize()
           
 Properties findNode(java.lang.String key)
           Finds node.
 java.lang.String getDefault(java.lang.String key)
           Gets the default value corresponding to the specified key.
 java.lang.String getDefaultValue()
           Gets the default value to an object concerned Properties.
 java.util.Vector<Properties> getLeaf()
           Gets the leaf to an object concerned Properties.
 java.lang.String getName()
           Gets the key to an object concerned Properties.
 Properties getNode(java.lang.String key)
           acquires the Properties object that maintains the value corresponding to the specified key.
 java.lang.String getProperty(java.lang.String key)
           acquires the value corresponding to the specified key.
 java.lang.String getProperty(java.lang.String key, java.lang.String alternative)
           Gets the value corresponding to the specified key.
 Properties getRoot()
           Gets the root to an object concerned Properties.
 java.lang.String getValue()
           Gets the value to an object concerned Properties.
 Properties hasKey(java.lang.String key)
           examines whether something with the specified key exists in the child node of the Properties object.
protected  java.lang.String indent(int index)
           
 void list(java.io.OutputStream out)
           {@.en outputs the content of a Properties object to the specified output stream.
 void load(java.io.BufferedReader reader)
           Reads the property set from the specified buffer.
 void merge(Properties prop)
           merges the specified Properties object with an object concerned Properties.
 java.util.Vector<java.lang.String> propertyNames()
           acquires the list of the key that exists among the Properties object and the child nodes.
 Properties removeNode(java.lang.String name)
           Separates child node Properties of the specified key from concerned Properties.
 void save(java.io.OutputStream out, java.lang.String header)
           Outputs the content of a Properties to the specified stream.
 java.lang.String setDefault(java.lang.String key, java.lang.String defaultValue)
           sets the default value corresponding to the specified key.
 void setDefaults(java.lang.String[] defaults)
           Sets the default value corresponding to the specified key.
 java.lang.String setProperty(java.lang.String key, java.lang.String value)
           Registers the value corresponding to the specified key.
 int size()
           acquires the number of properties that exist among the Properties object and the child nodes.
protected  boolean split(java.lang.String str, char delim, java.util.Vector<java.lang.String> values)
          
protected  Pair<java.lang.String,java.lang.String> splitKeyValue(java.lang.String str)
          
 void store(java.io.OutputStream out, java.lang.String header)
           Outputs the content of a Properties to the specified stream.
 void substitute(Properties prop)
           copies the Properties object.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Properties

public Properties()
Default constructor


Properties

public Properties(java.lang.String key)
Constructor

The property with the specified key is initialized. The value corresponding to the specified key becomes a null character string.

Parameters:
key - key

Properties

public Properties(java.lang.String key,
                  java.lang.String value)
Constructor

The property with specified key and value is initialized.

Parameters:
key - key
value - value

Properties

public Properties(java.util.Map<java.lang.String,java.lang.String> defaults)
Constructor

Default is initialized by the specified data.

Parameters:
defaults - Map object with key and value of default

Properties

public Properties(java.lang.String[] defaults)
Constructor

Default is initialized by the specified data.

Parameters:
defaults - Default value alternately arranged in order of key and value

Properties

public Properties(Properties prop)
Cpoy constructor

copies the Properties object.

Parameters:
prop - Properties object that becomes copy origin
Method Detail

substitute

public void substitute(Properties prop)
copies the Properties object.

Parameters:
prop - Properties object that becomes copy origin

destruct

public void destruct()
Destructor processing

It separates from the parent node clearing the content of the Properties object. Moreover, the destructor of all the child nodes is processed.


finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

getName

public java.lang.String getName()
Gets the key to an object concerned Properties.

Returns:
key

getValue

public java.lang.String getValue()
Gets the value to an object concerned Properties.

Returns:
value

getDefaultValue

public java.lang.String getDefaultValue()
Gets the default value to an object concerned Properties.

Returns:
default value

getLeaf

public java.util.Vector<Properties> getLeaf()
Gets the leaf to an object concerned Properties.

Returns:
Child node Properties object list

getRoot

public Properties getRoot()
Gets the root to an object concerned Properties.

Returns:
root Properties object list

getProperty

public java.lang.String getProperty(java.lang.String key)
acquires the value corresponding to the specified key.

Parameters:
key - key
Returns:

getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String alternative)
Gets the value corresponding to the specified key.

When the specified key doesn't exist or the value corresponding to the key is a null character string, the specified alternative value is gotten.

Parameters:
key - i key
alternative - Alternative value
Returns:
Returns the value corresponding to the specified key. When the specified key doesn't exist, and the value corresponding to the key is a null character string, an alternative value is returned.

getDefault

public java.lang.String getDefault(java.lang.String key)
Gets the default value corresponding to the specified key.

Parameters:
key - key
Returns:
When the specified key exists, the default value corresponding to it is returned. When the specified key doesn't exist, the null character string is returned.

setProperty

public java.lang.String setProperty(java.lang.String key,
                                    java.lang.String value)
Registers the value corresponding to the specified key.

Parameters:
key - key
value - value
Returns:
A set value is returned. When a set value doesn't exist, the default value is returned.

setDefault

public java.lang.String setDefault(java.lang.String key,
                                   java.lang.String defaultValue)
sets the default value corresponding to the specified key.

Parameters:
key - key
defaultValue - Default value

setDefaults

public void setDefaults(java.lang.String[] defaults)
Sets the default value corresponding to the specified key.

Parameters:
defaults - Default value in which key and value are alternately displayed

list

public void list(java.io.OutputStream out)
outputs the content of a Properties object to the specified output stream.

Parameters:
out - output stream

load

public void load(java.io.BufferedReader reader)
          throws java.io.IOException
Reads the property set from the specified buffer.

Parameters:
reader - buffer
Throws:
java.io.IOException

save

public void save(java.io.OutputStream out,
                 java.lang.String header)
Outputs the content of a Properties to the specified stream.

Parameters:
out - output stream
header - String added to head of content of output

store

public void store(java.io.OutputStream out,
                  java.lang.String header)
Outputs the content of a Properties to the specified stream.

Parameters:
out - output stream
header - String added to head of content of output

propertyNames

public final java.util.Vector<java.lang.String> propertyNames()
acquires the list of the key that exists among the Properties object and the child nodes.

Returns:
list of key

size

public final int size()
acquires the number of properties that exist among the Properties object and the child nodes.

Returns:
the number of properties

findNode

public final Properties findNode(java.lang.String key)
Finds node.

Parameters:
key - key
Returns:
Properties

getNode

public final Properties getNode(java.lang.String key)
acquires the Properties object that maintains the value corresponding to the specified key.

Parameters:
key - key
Returns:
Properties object that maintains value corresponding to specified key

createNode

public boolean createNode(java.lang.String key)
makes the child node the Properties object of the specified key.

Parameters:
key - key
Returns:
When the specified key has already existed, false is returned.

removeNode

public Properties removeNode(java.lang.String name)
Separates child node Properties of the specified key from concerned Properties.

Parameters:
name - Key to child node that separates
Returns:
The separated child node Properties object is returned.

hasKey

public final Properties hasKey(java.lang.String key)
examines whether something with the specified key exists in the child node of the Properties object.

Parameters:
key - key
Returns:
The Properties object corresponding to the specified key is returned.

clear

public void clear()
Deletes all his child nodes.


merge

public void merge(Properties prop)
merges the specified Properties object with an object concerned Properties.

Parameters:
prop - Properties object in merging origin

splitKeyValue

protected Pair<java.lang.String,java.lang.String> splitKeyValue(java.lang.String str)

Parameters:
str -
Returns:

split

protected boolean split(java.lang.String str,
                        char delim,
                        java.util.Vector<java.lang.String> values)

Parameters:
str -
delim -
Returns:

indent

protected java.lang.String indent(int index)

_getNode

protected Properties _getNode(java.util.Vector<java.lang.String> keys,
                              int index,
                              Properties curr)

_propertyNames

protected void _propertyNames(java.util.Vector<java.lang.String> names,
                              java.lang.String curr_name,
                              Properties curr)

_store

protected void _store(java.io.OutputStream out,
                      java.lang.String curr_name,
                      Properties curr)

_dump

protected java.io.OutputStream _dump(java.io.OutputStream out,
                                     Properties curr,
                                     int index)

_dump

public java.lang.String _dump(java.lang.String out,
                              Properties curr,
                              int index)
makes the content of Properties a character string.

Parameters:
out - String for output
curr - Properties
index - Hierarchy