In the Person
example, Nucleus creates a component of class Person
, and sets the values of a String
and int
property from the values found in the properties file. Nucleus can parse these values from the properties file because it is 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.
Simple Property Types
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
Complex Property Types
The following table lists more complex Java data types that Nucleus can parse from properties files, and describes how Nucleus interprets each value:
Data Type | Value |
---|---|
| Read from the properties file as a String, then converted into a file. For example, if the value is |
| An absolute configuration pathname—for example, |
| Parsed according to the rules of the default |
| Read as a comma-separated list of |
| 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). |
| Read as a comma-separated list of |
| A map property whose values are linked to a property of another component (see Linking Map Properties) |
Arrays as Property Values
Nucleus can parse arrays of any of the types shown earlier. Nucleus parses an array by assuming that the element values are separated by commas. For example, a property named heights
might be defined by the following methods:
public double [] getHeights ();
public void setHeights (double [] heights);
The heights
property might be set by the following properties file entry:
heights=3.2,-12.7,44.6
In this case, Nucleus creates an array of three doubles
, and assigns that array to the component by calling setHeights()
.
Leading and trailing white spaces are included in element values. For example, given the following property setting:
name=Mary,Paul, Peter
array elements Paul and Peter embed a trailing space and a leading space, respectively.
Hashtables as Property Values
Hashtable property 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.
Defining Property Types
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
.