org.apache.ftpserver.util
Class BaseProperties

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.apache.ftpserver.util.BaseProperties
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>

public class BaseProperties
extends Properties

This class encapsulates java.util.Properties to add java primitives and some other java classes.

Author:
Rana Bhattacharyya
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
BaseProperties()
          Default constructor.
BaseProperties(File fl)
          Load properties from file
BaseProperties(InputStream is)
          Load properties from InputStream
BaseProperties(Properties prop)
          Load existing property.
 
Method Summary
 List getAllKeys()
          Get all property key names.
 boolean getBoolean(String str)
          Get boolean value.
 boolean getBoolean(String str, boolean bol)
           
 Class getClass(String str)
          Get Class object
 Class getClass(String str, Class cls)
           
 Date getDate(String str, DateFormat fmt)
          Get Date object.
 Date getDate(String str, DateFormat fmt, Date dt)
           
 SimpleDateFormat getDateFormat(String str)
          Get DateFormat object.
 SimpleDateFormat getDateFormat(String str, SimpleDateFormat fmt)
           
 double getDouble(String str)
          Get double value.
 double getDouble(String str, double doubleVal)
           
 File getFile(String str)
          Get File object.
 File getFile(String str, File fl)
           
 InetAddress getInetAddress(String str)
          Get InetAddress.
 InetAddress getInetAddress(String str, InetAddress addr)
           
 int getInteger(String str)
          Get integer value.
 int getInteger(String str, int intVal)
           
 long getLong(String str)
          Get long value.
 long getLong(String str, long val)
           
 TimeZone getTimeZone(String str)
          Get TimeZone
 TimeZone getTimeZone(String str, TimeZone tz)
           
 void setInetAddress(String key, InetAddress val)
          Set InetAddress.
 void setProperty(String key, boolean val)
          Set boolean value.
 void setProperty(String key, Class val)
          Set Class object.
 void setProperty(String key, Date val, DateFormat fmt)
          Set Date object.
 void setProperty(String key, double val)
          Set double value.
 void setProperty(String key, File val)
          Set File object.
 void setProperty(String key, float val)
          Set float value.
 void setProperty(String key, int val)
          Set integer value.
 void setProperty(String key, long val)
          Set long value.
 void setProperty(String key, SimpleDateFormat val)
          Set DateFormat object.
 void setProperty(String key, TimeZone val)
          Set TimeZone object.
 
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

BaseProperties

public BaseProperties()
Default constructor.


BaseProperties

public BaseProperties(Properties prop)
Load existing property.


BaseProperties

public BaseProperties(File fl)
               throws IOException
Load properties from file

Throws:
IOException

BaseProperties

public BaseProperties(InputStream is)
               throws IOException
Load properties from InputStream

Throws:
IOException
Method Detail

getAllKeys

public List getAllKeys()
Get all property key names.


getBoolean

public boolean getBoolean(String str)
                   throws PropertiesException
Get boolean value.

Throws:
PropertiesException

getBoolean

public boolean getBoolean(String str,
                          boolean bol)

getInteger

public int getInteger(String str)
               throws PropertiesException
Get integer value.

Throws:
PropertiesException

getInteger

public int getInteger(String str,
                      int intVal)

getLong

public long getLong(String str)
             throws PropertiesException
Get long value.

Throws:
PropertiesException

getLong

public long getLong(String str,
                    long val)

getDouble

public double getDouble(String str)
                 throws PropertiesException
Get double value.

Throws:
PropertiesException

getDouble

public double getDouble(String str,
                        double doubleVal)

getInetAddress

public InetAddress getInetAddress(String str)
                           throws PropertiesException
Get InetAddress.

Throws:
PropertiesException

getInetAddress

public InetAddress getInetAddress(String str,
                                  InetAddress addr)

getFile

public File getFile(String str)
             throws PropertiesException
Get File object.

Throws:
PropertiesException

getFile

public File getFile(String str,
                    File fl)

getClass

public Class getClass(String str)
               throws PropertiesException
Get Class object

Throws:
PropertiesException

getClass

public Class getClass(String str,
                      Class cls)

getTimeZone

public TimeZone getTimeZone(String str)
                     throws PropertiesException
Get TimeZone

Throws:
PropertiesException

getTimeZone

public TimeZone getTimeZone(String str,
                            TimeZone tz)

getDateFormat

public SimpleDateFormat getDateFormat(String str)
                               throws PropertiesException
Get DateFormat object.

Throws:
PropertiesException

getDateFormat

public SimpleDateFormat getDateFormat(String str,
                                      SimpleDateFormat fmt)

getDate

public Date getDate(String str,
                    DateFormat fmt)
             throws PropertiesException
Get Date object.

Throws:
PropertiesException

getDate

public Date getDate(String str,
                    DateFormat fmt,
                    Date dt)

setProperty

public void setProperty(String key,
                        boolean val)
Set boolean value.


setProperty

public void setProperty(String key,
                        int val)
Set integer value.


setProperty

public void setProperty(String key,
                        double val)
Set double value.


setProperty

public void setProperty(String key,
                        float val)
Set float value.


setProperty

public void setProperty(String key,
                        long val)
Set long value.


setInetAddress

public void setInetAddress(String key,
                           InetAddress val)
Set InetAddress.


setProperty

public void setProperty(String key,
                        File val)
Set File object.


setProperty

public void setProperty(String key,
                        SimpleDateFormat val)
Set DateFormat object.


setProperty

public void setProperty(String key,
                        TimeZone val)
Set TimeZone object.


setProperty

public void setProperty(String key,
                        Date val,
                        DateFormat fmt)
Set Date object.


setProperty

public void setProperty(String key,
                        Class val)
Set Class object.



Copyright © 2001-2012 Codehaus. All Rights Reserved.