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

java.io.File

The value is read from the properties file as a String, then converted into a file. For example, if the value is c:\docs\doc1 then the File object is equivalent to calling new File ("c:\docs\doc1").

atg.xml.XMLFile

The value is an absolute CONFIGPATH pathname. For example, /atg/dynamo/service/template.xml

java.util.Date

The value is parsed according to the rules of the default java.text.DateFormatter.

java.util.Properties

The value is read as a comma-separated list of key=value pairs. For example, a=17,b=12,c=somestring.

java.lang.Class

The value is read as a class name, and Class.forName() is called to convert the name to a Class. If there is no such class, then an exception is thrown.

java.net.InetAddress

See IP Addresses in Properties Files in this section for information about setting numeric InetAddress properties.

atg.repository.rql
.RqlStatement

A Repository Query Language statement (see the ATG Repository Guide).

atg.nucleus.ServiceMap

The value is read as a comma-separated list of key=serviceName pairs. For example, a=/cart,b=../foreach (see ServiceMap Properties).

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.

 
loading table of contents...