mdh.hephaestus2
Class Props

java.lang.Object
  |
  +--mdh.hephaestus2.Props
All Implemented Interfaces:
Cloneable, Serializable

public class Props
extends Object
implements Cloneable, Serializable

A collection of key/value pairs, with default values.

Author:
Copyright © 2002 by Mark Hughes <kamikaze@kuoi.asui.uidaho.edu>
See Also:
Serialized Form

Constructor Summary
Props()
          Creates an empty Props.
Props(BufferedReader in)
          Reads a Props from a reader.
 
Method Summary
 Object clone()
           
 boolean containsKey(String key)
          Returns true if the key is defined.
 int decr(String key)
          Decrements an int property by 1.
 boolean getBoolean(String key)
          Returns a boolean value, or false if it is not defined.
 int getInt(String key)
          Returns an int value, or 0 if it is not defined.
 String getNullString(String key)
          Returns a String value, or null if it is not defined or is empty.
 String getString(String key)
          Returns a String value, or "" if it is not defined.
 int incr(String key)
          Increments an int property by 1.
 Iterator keys()
          Returns an iterator over the list of keys.
 void read(BufferedReader in)
           
 void set(String key, boolean b)
          Stores a boolean value.
 void set(String key, int i)
          Stores an int value.
 void set(String key, String s)
          Stores a String value.
 int size()
          Returns the number of defined properties.
 String toString()
           
 void write(BufferedWriter out)
           
 void write(StringBuffer sb)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Props

public Props()
Creates an empty Props.


Props

public Props(BufferedReader in)
      throws IOException
Reads a Props from a reader.

Method Detail

clone

public Object clone()
Overrides:
clone in class Object

containsKey

public boolean containsKey(String key)
Returns true if the key is defined.


decr

public int decr(String key)
Decrements an int property by 1.


getBoolean

public boolean getBoolean(String key)
Returns a boolean value, or false if it is not defined. If the value is not a boolean, it is converted and stored.


getInt

public int getInt(String key)
Returns an int value, or 0 if it is not defined. If the value is not an int, it is converted and stored.


getString

public String getString(String key)
Returns a String value, or "" if it is not defined. If the value is not a String, it is converted.


getNullString

public String getNullString(String key)
Returns a String value, or null if it is not defined or is empty. If the value is not a String, it is converted.


incr

public int incr(String key)
Increments an int property by 1.


keys

public Iterator keys()
Returns an iterator over the list of keys.


set

public void set(String key,
                boolean b)
Stores a boolean value.


set

public void set(String key,
                int i)
Stores an int value.


set

public void set(String key,
                String s)
Stores a String value.


size

public int size()
Returns the number of defined properties.


read

public void read(BufferedReader in)
          throws IOException
IOException

toString

public String toString()
Overrides:
toString in class Object

write

public void write(BufferedWriter out)
           throws IOException
IOException

write

public void write(StringBuffer sb)