JEphem site
jephem API
Build classes

tig
Class TigProperties

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--java.util.Properties
                    |
                    +--tig.TigProperties
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class TigProperties
extends java.util.Properties

Superclass for Preferences classes.
The getXxxProperty() method behave like method getProperty(String key), inherited from Properties class : if the property can't be correctly retrieved, an exception is thrown.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
TigProperties()
           
 
Method Summary
 boolean getBooleanProperty(java.lang.String key)
          Returns a property of type boolean.
 boolean getBooleanProperty(java.lang.String key, boolean defaultValue)
          Returns a property of type boolean.
 double getDoubleProperty(java.lang.String key)
          Returns a property of type double.
 double getDoubleProperty(java.lang.String key, double defaultValue)
          Returns a property of type double.
 int[] getIntArrayProperty(java.lang.String key)
          Returns a property of type int[].
 int[] getIntArrayProperty(java.lang.String key, int[] defaultValue)
          Returns a property of type int[].
static int getIntConstant(java.lang.String constantName, java.lang.String className)
          Convenient method to get a static final int field of a class, using reflection.
 int getIntProperty(java.lang.String key)
          Returns a property of type int.
 int getIntProperty(java.lang.String key, int defaultValue)
          Returns a property of type int.
 void setBooleanProperty(java.lang.String key, boolean booleanValue)
          Sets a property of type boolean.
 void setDoubleProperty(java.lang.String key, double doubleValue)
          Sets a property of type double.
 void setIntArrayProperty(java.lang.String key, int[] intArray)
          Sets a property of type int[].
 void setIntProperty(java.lang.String key, int intValue)
          Sets a property of type int.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, propertyNames, save, setProperty, store
 
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

TigProperties

public TigProperties()
Method Detail

getIntConstant

public static int getIntConstant(java.lang.String constantName,
                                 java.lang.String className)
Convenient method to get a static final int field of a class, using reflection.
For example, if you have this piece of code in a class :
package mypackage;
   public class MyClass{
     public static final int MY_CONSTANT = 8;
   }
The call : TigBundle.getIntConstant("My_CONSTANT", "mypackage.MyClass"); will then return 8.

Throws:
java.lang.RuntimeException - If the property can't be correctly retrieved.

getIntProperty

public int getIntProperty(java.lang.String key)
Returns a property of type int.

Throws:
java.lang.NumberFormatException - If the property can't be retrieved, or can't be converted to an integer.

getIntProperty

public int getIntProperty(java.lang.String key,
                          int defaultValue)
Returns a property of type int.
If the property can't be retrieved, or can't be converted to an integer, the default value is returned.


setIntProperty

public void setIntProperty(java.lang.String key,
                           int intValue)
Sets a property of type int.


getDoubleProperty

public double getDoubleProperty(java.lang.String key)
Returns a property of type double.
If the property can't be retrieved, or if it can't be converted to a double, null is returned.


getDoubleProperty

public double getDoubleProperty(java.lang.String key,
                                double defaultValue)
Returns a property of type double.
If the property can't be retrieved, or can't be converted to a double, the default value is returned.


setDoubleProperty

public void setDoubleProperty(java.lang.String key,
                              double doubleValue)
Sets a property of type double.


getBooleanProperty

public boolean getBooleanProperty(java.lang.String key)
Returns a property of type boolean.
  • Returns true if the property exists and equals (ignoring case) to "true".
  • Returns false if the property exists and equals (ignoring case) to "false".
  • A RuntimeException is thrown otherwise.

  • getBooleanProperty

    public boolean getBooleanProperty(java.lang.String key,
                                      boolean defaultValue)
    Returns a property of type boolean.
  • Returns true if the property exists and equals (ignoring case) to "true".
  • Returns false if the property exists and equals (ignoring case) to "false".
  • 'defaultValue' is returned otherwise.

  • setBooleanProperty

    public void setBooleanProperty(java.lang.String key,
                                   boolean booleanValue)
    Sets a property of type boolean.


    getIntArrayProperty

    public int[] getIntArrayProperty(java.lang.String key)
    Returns a property of type int[].
    The value corresponding to key is a Sting, and must contain a list of substrings which can be parsed to integers, and separated by comas.
    For example, "12, 23, 34" is a correct value.

    Throws:
    java.lang.RuntimeException - If the property corresponding to 'key' can't be parsed that way.

    getIntArrayProperty

    public int[] getIntArrayProperty(java.lang.String key,
                                     int[] defaultValue)
    Returns a property of type int[].
    The value corresponding to key is a Sting, and must contain a list of substrings which can be parsed to integers, and separated by comas.
    For example, "12, 23, 34" is a correct value.

    If the property corresponding to 'key' can't be parsed that way, 'defaultValue' is returned.


    setIntArrayProperty

    public void setIntArrayProperty(java.lang.String key,
                                    int[] intArray)
    Sets a property of type int[].
    The int[] is transformed to a String.
    Ex : if 'intArray' contains 1, 4, 7 and 5, it will be stored as "1, 4, 7, 5".
    int[] stored this way can be retrived with getIntArrayProperty(String)


    JEphem site
    jephem API
    Build classes