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

java.io.File

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

An absolute configuration pathname—for example, /atg/dynamo/service/template.xml.

java.util.Date

Parsed according to the rules of the default java.text.DateFormatter.

java.util.Properties

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

java.lang.Class

Read as a class name, and Class.forName() is called to convert the name to a Class. If there is no such class, 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 Repository Guide).

atg.nucleus.ServiceMap

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

atg.nucleus.ResolvingMap 

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. In this example, array elements Paul and Peter embed a trailing space and a leading space, respectively:

name=Mary,Paul , Peter
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.


Copyright © 1997, 2016 Oracle and/or its affiliates. All rights reserved. Legal Notices