public class PropertyResourceBundleReader
extends java.lang.Object
The PropertyResourceBundleReader is used by the ResourceBundleDataBean and Member Subsystem commands to find property files and reorganize the information of property files to different formats. To find a property file, three parameters are needed:
After these parameters are set and the data bean is activated, the information in the property file can be retrieved using the following methods:
If you have a property file named UserRegistration_en_US.properties that contains the following content (the number can be anything, but must be in ascendent order):
. . . 100.Name=children 100.Label=Number Of Children 100.Displayed=yes 100.Required=no 100.Size=5 105.Name=age 105.Label=Age 105.Displayed=yes 105.Required=no 105.Options=0;Not Provided|1;10-19 years|2;20-29 years|3;30-39 years|4;40-49 years|5;50-59 years|6;60 years or older 110.Name=gender 110.Label=Gender 110.Displayed=yes 110.Required=no 110.Options=N;Not Provided|M;Male|F;Female
Note:
| -- Default Delimiter (You can use setDelimiter(String) method to set a different Delimiter)
; -- Default Separator (You can use setSeparator(String) method to set a different Separator)
For example:
If you have a property file named UserRegistration_en_US.properties, which contains the following content: . . . children.Label=Number Of Children children.Displayed=yes children.Required=no age.Label=Age age.Displayed=yes age.Required=no age.Options=0;Not Available|1;10-19 years|2;20-29 years|3;30-39 years|4;40-49 years|5;50-59 years|6;60 years or older age.Operators=>;Older than|<;Yonger than|!=;Not equal to gender.Label=Gender gender.Displayed=yes gender.Required=no gender.Options=Male|Female . . .
Modifier and Type | Field and Description |
---|---|
static java.lang.String | CLASSNAME
The class name.
|
static java.lang.String | COPYRIGHT
IBM copyright.
|
static java.util.Locale | DEFALUT_LOCALE
The default locale used to find property file.
|
static java.lang.String | DEFAULT_DELIMITER
The default delimiter used to separate different options.
|
static java.lang.String | DEFAULT_PATH_SEPARATOR
The default separator used to separate resource property file name and its path.
|
static java.lang.String | DEFAULT_SEPARATOR
The default separator used to separate internal value and display value in an option.
|
Constructor and Description |
---|
PropertyResourceBundleReader() |
Modifier and Type | Method and Description |
---|---|
CommandContext | getCommandContext()
Gets the command context.
|
java.lang.String | getDelimiter()
Gets the delimiter for the property file.
|
java.lang.String | getFoundPropertyFilePath()
Gets the path for the property file that was found.
|
java.util.Locale | getLocale()
Gets the Locale.
|
java.lang.String | getPathSeparator()
Gets the path separator, that is used to separate the store directory and the property file name.
|
java.lang.String | getPropertyFileName()
Gets the name of property file.
|
java.util.Hashtable | getPropertyHashtable()
Gets the property file as a Hashtable.
|
java.util.PropertyResourceBundle | getPropertyResourceBundle()
Gets the property file as a PropertyResourceBundle object.
|
java.util.SortedMap | getPropertySortedMap()
Gets the property file as a SortedMap.
|
java.lang.String | getSeparator()
Gets the separator for the property file.
|
java.lang.String | getStoreDirectory()
Gets the name of the store directory, which is used for finding property files belonging to this store.
|
java.util.PropertyResourceBundle | getTextPropertyResourceBundle()
Gets the text property file as a PropertyResourceBundle object.
|
void | read()
Gets the SortedMap from the properties file using the specified property file name, store directory, command context, locale, delimiter and separator.
|
static java.util.Hashtable | readProperties(java.lang.String astrPropertyFileName)
Gets the Hashtable from the properties file using the specified property file name.
|
static java.util.Hashtable | readProperties(java.lang.String astrPropertyFileName, java.util.Locale alcLocale)
Gets the Hashtable from the properties file using the specified property file name and locale.
|
static java.util.Hashtable | readProperties(java.lang.String astrPropertyFileName, java.util.Locale alcLocale, java.lang.String astrDelimiter, java.lang.String astrSeparator)
Gets the Hashtable from the properties file using the specified property file name, locale, delimiter and separator.
|
static java.util.SortedMap | readSortedProperties(java.lang.String astrPropertyFileName)
Gets the SortedMap from the properties file using the specified property file name.
|
static java.util.SortedMap | readSortedProperties(java.lang.String astrPropertyFileName, java.util.Locale alcLocale)
Gets the SortedMap from the properties file using the specified property file name and locale.
|
static java.util.SortedMap | readSortedProperties(java.lang.String astrPropertyFileName, java.util.Locale alcLocale, java.lang.String astrDelimiter, java.lang.String astrSeparator)
Gets the SortedMap from the properties file using the specified property file name, locale, delimiter and separator.
|
void | setCommandContext(CommandContext acommandContext)
Sets the command context.
|
void | setDelimiter(java.lang.String astrDelimiter)
Sets the delimiter for the property file.
|
void | setLocale(java.util.Locale alcLocale)
Set the Locale.
|
void | setPathSeparator(java.lang.String astrPathSeparator)
Sets the path separator, that is used to separate the store directory and the property file name.
|
void | setPropertyFileName(java.lang.String astrPropertyFileName)
Sets the name of property file.
|
void | setSeparator(java.lang.String astrSeparator)
Sets the separator for the property file.
|
void | setStoreDirectory(java.lang.String astrStoreDirectory)
Sets the name of store directory, which is used as the path to the find the property file.
|
public static final java.lang.String COPYRIGHT
public static final java.lang.String CLASSNAME
public static final java.lang.String DEFAULT_PATH_SEPARATOR
public static final java.lang.String DEFAULT_DELIMITER
public static final java.lang.String DEFAULT_SEPARATOR
public static final java.util.Locale DEFALUT_LOCALE
public void setPropertyFileName(java.lang.String astrPropertyFileName)
public java.lang.String getPropertyFileName()
public void setStoreDirectory(java.lang.String astrStoreDirectory)
public java.lang.String getStoreDirectory()
public void setLocale(java.util.Locale alcLocale)
public java.util.Locale getLocale()
public void setCommandContext(CommandContext acommandContext)
public CommandContext getCommandContext()
public void setDelimiter(java.lang.String astrDelimiter)
public java.lang.String getDelimiter()
public void setSeparator(java.lang.String astrSeparator)
public java.lang.String getSeparator()
public void setPathSeparator(java.lang.String astrPathSeparator)
public java.lang.String getPathSeparator()
public void read()
public java.lang.String getFoundPropertyFilePath()
public java.util.PropertyResourceBundle getPropertyResourceBundle()
public java.util.PropertyResourceBundle getTextPropertyResourceBundle()
public java.util.SortedMap getPropertySortedMap()
public java.util.Hashtable getPropertyHashtable()
public static java.util.Hashtable readProperties(java.lang.String astrPropertyFileName)
public static java.util.Hashtable readProperties(java.lang.String astrPropertyFileName, java.util.Locale alcLocale)
public static java.util.Hashtable readProperties(java.lang.String astrPropertyFileName, java.util.Locale alcLocale, java.lang.String astrDelimiter, java.lang.String astrSeparator)
public static java.util.SortedMap readSortedProperties(java.lang.String astrPropertyFileName)
public static java.util.SortedMap readSortedProperties(java.lang.String astrPropertyFileName, java.util.Locale alcLocale)
public static java.util.SortedMap readSortedProperties(java.lang.String astrPropertyFileName, java.util.Locale alcLocale, java.lang.String astrDelimiter, java.lang.String astrSeparator)