Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

hk.hku.cecid.phoenix.common.util
Class TextProperty  view TextProperty download TextProperty.java

java.lang.Object
  extended byhk.hku.cecid.phoenix.common.util.Property
      extended byhk.hku.cecid.phoenix.common.util.TextProperty

public class TextProperty
extends Property

This is a concrete implementation of the property object for loading and saving the property content into a text-based file. The format used is exactly the same of Java properties file.

Version:
$Revision: 1.6 $

Field Summary
protected  java.lang.String fileName
          Internal variable for holding the file name of the property file
protected  java.util.Properties prop
          Internal variable for holding the Java build in Properties object for manipulation
 
Fields inherited from class hk.hku.cecid.phoenix.common.util.Property
cache, DEFAULT_FILENAME, PROP_HOME
 
Constructor Summary
  TextProperty()
          Default constructor.
(package private) TextProperty(java.lang.String fileName)
          Internal constructor.
 
Method Summary
 java.lang.String get(java.lang.String path)
          Gets the property value given the path (key).
 java.lang.String get(java.lang.String path, java.lang.String defaultValue)
          Gets the property value given the path (key).
 java.lang.String[] getMultiple(java.lang.String path)
          Gets the property value given the path (key).
 void save()
          Saves the property object to the same location when loading.
 void save(java.lang.String fileName)
          Saves the property object to the specified location.
 void set(java.lang.String path, java.lang.String value)
          Sets the property value of the given path (key).
 
Methods inherited from class hk.hku.cecid.phoenix.common.util.Property
getFromCache, load, load, loadFromFullPath, reload, reload, removeFromCache, saveToCache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileName

protected java.lang.String fileName
Internal variable for holding the file name of the property file


prop

protected java.util.Properties prop
Internal variable for holding the Java build in Properties object for manipulation

Constructor Detail

TextProperty

TextProperty(java.lang.String fileName)
       throws java.io.IOException
Internal constructor. Not to be called by user. This loads the content of the specified property file into memory.


TextProperty

public TextProperty()
Default constructor. This is for creating a brand new text-based property object.

Method Detail

getMultiple

public java.lang.String[] getMultiple(java.lang.String path)
Gets the property value given the path (key). Not supported for text based properties file.

Specified by:
getMultiple in class Property

get

public java.lang.String get(java.lang.String path)
Gets the property value given the path (key).

Specified by:
get in class Property

get

public java.lang.String get(java.lang.String path,
                            java.lang.String defaultValue)
Gets the property value given the path (key). If the property value is not found, the default value passed in is returned.

Specified by:
get in class Property

set

public void set(java.lang.String path,
                java.lang.String value)
Sets the property value of the given path (key).

Specified by:
set in class Property

save

public void save()
          throws java.io.IOException
Saves the property object to the same location when loading.

Specified by:
save in class Property

save

public void save(java.lang.String fileName)
          throws java.io.IOException
Saves the property object to the specified location.

Specified by:
save in class Property