org.infinispan.util
Class TypedProperties

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<Object,Object>
          extended by java.util.Properties
              extended by org.infinispan.util.TypedProperties
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public class TypedProperties
extends Properties

Type-aware properties. Extends the JDK Properties class to provide accessors that convert values to certain types, using default values if a conversion is not possible.

Since:
4.0
Author:
Manik Surtani
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
TypedProperties()
          Default constructor that returns an empty instance
TypedProperties(Properties p)
          Copy constructor
 
Method Summary
 boolean getBooleanProperty(String key, boolean defaultValue)
           
 int getIntProperty(String key, int defaultValue)
           
 long getLongProperty(String key, long defaultValue)
           
static TypedProperties toTypedProperties(Properties p)
          Factory method that converts a JDK Properties instance to an instance of TypedProperties, if needed.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, 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(Properties p)
Copy constructor

Parameters:
p - properties instance to from. If null, then it is treated as an empty Properties instance.

TypedProperties

public TypedProperties()
Default constructor that returns an empty instance

Method Detail

toTypedProperties

public static TypedProperties toTypedProperties(Properties p)
Factory method that converts a JDK Properties instance to an instance of TypedProperties, if needed.

Parameters:
p - properties to convert.
Returns:
A TypedProperties object. Returns an empty TypedProperties instance if p is null.

getIntProperty

public int getIntProperty(String key,
                          int defaultValue)

getLongProperty

public long getLongProperty(String key,
                            long defaultValue)

getBooleanProperty

public boolean getBooleanProperty(String key,
                                  boolean defaultValue)

Google Analytics

Copyright © 2010 JBoss, a division of Red Hat. All Rights Reserved.