Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.openjpa.lib.util
Class TypedProperties

    java.lang.Object
      java.util.Dictionary<K,V>
          java.util.Hashtable<Object,Object>
              java.util.Properties
                  org.apache.openjpa.lib.util.TypedProperties

All Implemented Interfaces:
  Serializable, Cloneable, Map<Object,Object>

Direct Known Subclasses:
  Options

    public class TypedProperties

extends Properties

A specialization of the `Properties` map type with added convenience methods to retrieve and set options as primitive values. The internal representation of all data is kept in string form.

Author:
  Abe White
See Also:
  Serialized Form

Field Summary

Fields inherited from class java.util.Properties
`defaults`

Constructor Summary
`TypedProperties()` Default constructor.
`TypedProperties(Properties defaults)` Construct the properties instance with the given set of defaults.

Method Summary
`boolean` | `getBooleanProperty(String key)` Return the property under the given key as a boolean, or false if it does not exist and has no set default.
`boolean` | `getBooleanProperty(String key, boolean def)` Return the property under the given key as a boolean, or the given default if it does not exist.
`double` | `getDoubleProperty(String key)` Return the property under the given key as a double, or 0 if it does not exist and has no set default.
`double` | `getDoubleProperty(String key, double def)` Return the property under the given key as a double, or the given default if it does not exist.
`float` | `getFloatProperty(String key)` Return the property under the given key as a float, or 0 if it does not exist and has no set default.
`float` | `getFloatProperty(String key, float def)` Return the property under the given key as a float, or the given default if it does not exist.
`int` | `getIntProperty(String key)` Return the property under the given key as an int, or 0 if it does not exist and has no set default.
`int` | `getIntProperty(String key, int def)` Return the property under the given key as an int, or the given default if it does not exist.
`long` | `getLongProperty(String key)` Return the property under the given key as a long, or 0 if it does not exist and has no set default.
`long` | `getLongProperty(String key, long def)` Return the property under the given key as a double, or the given default if it does not exist.
`boolean` | `removeBooleanProperty(String key)` Remove the property under the given key as a boolean.
`boolean` | `removeBooleanProperty(String key, boolean def)` Remove the property under the given key as a boolean, or return the given default if it does not exist.
`double` | `removeDoubleProperty(String key)` Remove the property under the given key as a double.
`double` | `removeDoubleProperty(String key, double def)` Remove the property under the given key as a double, or return the given default if it does not exist.
`float` | `removeFloatProperty(String key)` Remove the property under the given key as a float.
`float` | `removeFloatProperty(String key, float def)` Remove the property under the given key as a float, or return the given default if it does not exist.
`int` | `removeIntProperty(String key)` Remove the property under the given key as a int.
`int` | `removeIntProperty(String key, int def)` Remove the property under the given key as a int, or return the given default if it does not exist.
`long` | `removeLongProperty(String key)` Remove the property under the given key as a long.
`long` | `removeLongProperty(String key, long def)` Remove the property under the given key as a long, or return the given default if it does not exist.
`String` | `removeProperty(String key)` Remove the given property.
`String` | `removeProperty(String key, String def)` Remove the given property, or return the given default if it does not exist.
`void` | `setProperty(String key, boolean val)` Set the given key to a string version of the given value.
`void` | `setProperty(String key, double val)` Set the given key to a string version of the given value.
`void` | `setProperty(String key, float val)` Set the given key to a string version of the given value.
`void` | `setProperty(String key, int val)` Set the given key to a string version of the given value.
`void` | `setProperty(String key, long val)` Set the given key to a string version of the given value.
`Object` | `setProperty(String key, String val)` Overrides `Properties.setProperty(String,String)` to remove the key if the given value is `null`.

Methods inherited from class java.util.Properties
`getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, 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

### TypedProperties

    public TypedProperties()

  Default constructor.

### TypedProperties

    public TypedProperties(Properties defaults)

  Construct the properties instance with the given set of defaults.

  See Also:
    `Properties.Properties(Properties)`

Method Detail

### getBooleanProperty

    public boolean getBooleanProperty(String key)

  Return the property under the given key as a boolean, or false if it does not exist and has no set default.

### getBooleanProperty

    public boolean getBooleanProperty(String key,
                                      boolean def)

  Return the property under the given key as a boolean, or the given default if it does not exist.

### getFloatProperty

    public float getFloatProperty(String key)

  Return the property under the given key as a float, or 0 if it does not exist and has no set default.

  Throws:
    `NumberFormatException` - on parse error

### getFloatProperty

    public float getFloatProperty(String key,
                                  float def)

  Return the property under the given key as a float, or the given default if it does not exist.

  Throws:
    `NumberFormatException` - on parse error

### getDoubleProperty

    public double getDoubleProperty(String key)

  Return the property under the given key as a double, or 0 if it does not exist and has no set default.

  Throws:
    `NumberFormatException` - on parse error

### getDoubleProperty

    public double getDoubleProperty(String key,
                                    double def)

  Return the property under the given key as a double, or the given default if it does not exist.

  Throws:
    `NumberFormatException` - on parse error

### getLongProperty

    public long getLongProperty(String key)

  Return the property under the given key as a long, or 0 if it does not exist and has no set default.

  Throws:
    `NumberFormatException` - on parse error

### getLongProperty

    public long getLongProperty(String key,
                                long def)

  Return the property under the given key as a double, or the given default if it does not exist.

  Throws:
    `NumberFormatException` - on parse error

### getIntProperty

    public int getIntProperty(String key)

  Return the property under the given key as an int, or 0 if it does not exist and has no set default.

  Throws:
    `NumberFormatException` - on parse error

### getIntProperty

    public int getIntProperty(String key,
                              int def)

  Return the property under the given key as an int, or the given default if it does not exist.

  Throws:
    `NumberFormatException` - on parse error

### setProperty

    public Object setProperty(String key,
                              String val)

  Overrides `Properties.setProperty(String,String)` to remove the key if the given value is `null`.

  Overrides:
    `setProperty` in class `Properties`
  See Also:
    `Properties.setProperty(String,String)`

### setProperty

    public void setProperty(String key,
                            boolean val)

  Set the given key to a string version of the given value.

  See Also:
    `Properties.setProperty(String,String)`

### setProperty

    public void setProperty(String key,
                            double val)

  Set the given key to a string version of the given value.

  See Also:
    `Properties.setProperty(String,String)`

### setProperty

    public void setProperty(String key,
                            float val)

  Set the given key to a string version of the given value.

  See Also:
    `Properties.setProperty(String,String)`

### setProperty

    public void setProperty(String key,
                            int val)

  Set the given key to a string version of the given value.

  See Also:
    `Properties.setProperty(String,String)`

### setProperty

    public void setProperty(String key,
                            long val)

  Set the given key to a string version of the given value.

  See Also:
    `Properties.setProperty(String,String)`

### removeProperty

    public String removeProperty(String key)

  Remove the given property.

### removeProperty

    public String removeProperty(String key,
                                 String def)

  Remove the given property, or return the given default if it does not exist.

### removeBooleanProperty

    public boolean removeBooleanProperty(String key)

  Remove the property under the given key as a boolean.

### removeBooleanProperty

    public boolean removeBooleanProperty(String key,
                                         boolean def)

  Remove the property under the given key as a boolean, or return the given default if it does not exist.

### removeDoubleProperty

    public double removeDoubleProperty(String key)

  Remove the property under the given key as a double.

  Throws:
    `NumberFormatException` - on parse error

### removeDoubleProperty

    public double removeDoubleProperty(String key,
                                       double def)

  Remove the property under the given key as a double, or return the given default if it does not exist.

  Throws:
    `NumberFormatException` - on parse error

### removeFloatProperty

    public float removeFloatProperty(String key)

  Remove the property under the given key as a float.

  Throws:
    `NumberFormatException` - on parse error

### removeFloatProperty

    public float removeFloatProperty(String key,
                                     float def)

  Remove the property under the given key as a float, or return the given default if it does not exist.

  Throws:
    `NumberFormatException` - on parse error

### removeIntProperty

    public int removeIntProperty(String key)

  Remove the property under the given key as a int.

  Throws:
    `NumberFormatException` - on parse error

### removeIntProperty

    public int removeIntProperty(String key,
                                 int def)

  Remove the property under the given key as a int, or return the given default if it does not exist.

  Throws:
    `NumberFormatException` - on parse error

### removeLongProperty

    public long removeLongProperty(String key)

  Remove the property under the given key as a long.

  Throws:
    `NumberFormatException` - on parse error

### removeLongProperty

    public long removeLongProperty(String key,
                                   long def)

  Remove the property under the given key as a long, or return the given default if it does not exist.

  Throws:
    `NumberFormatException` - on parse error

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.