In the Person
example, Nucleus was able to create a component of class Person
, and set the values of a String
and int
property from the values found in the properties file. Nucleus was able to parse these values from the properties file because it was configured to recognize String
and int
property types. Nucleus can parse any property type for which a property editor is registered using the java.beans.PropertyEditorManager
class.
The following is a list of the simple Java data types that Nucleus can parse from properties files:
boolean
byte
char
short
int
long
float
double
java.lang.Boolean
java.lang.Byte
java.lang.Character
java.lang.Short
java.lang.Integer
java.lang.Long
java.lang.Float
java.lang.Double
java.lang.String
java.util.List
java.util.Map
java.util.Locale
In addition, the following table lists the more complex Java data types that Nucleus can parse from properties files, and describes how Nucleus interprets each value:
Data Type | Description |
---|---|
| The value is read from the properties file as a String, then converted into a file. For example, if the value is |
| The value is an absolute CONFIGPATH pathname. For example, |
| The value is parsed according to the rules of the default |
| The value is read as a comma-separated list of |
| The value is read as a class name, and |
| See IP Addresses in Properties Files in this section for information about setting numeric |
| A Repository Query Language statement (see the ATG Repository Guide). |
| The value is read as a comma-separated list of |
Arrays are also allowed to be property values, and Nucleus can parse arrays of any of the above types. Nucleus parses such an array by assuming that the element values are separated by commas. For example, consider a property named heights
defined by the following methods:
public double [] getHeights ();
public void setHeights (double [] heights);
This heights
property might be set by the following properties file entry:
heights=3.2,-12.7,44.6
In this case, Nucleus would create an array of three doubles
, and assign that array to the component by calling setHeights
. Note that white space around the commas is not ignored and is treated as part of the values. For example, an array of Strings defined as "name, age, sex"
would create Strings "name"
, " age"
, and " sex"
, with age
and sex
both preceded by a leading space.
You can have property values that are Hashtables. Values are parsed in the same way as java.util.Properties
and atg.nucleus.ServiceMap
type properties, as a comma-separated list of key=value
pairs.
You can define and register additional property types, using the setAsText
method of the JavaBean PropertyEditor
interface. See the JSDK API documentation for java.beans.PropertyEditor
.