# Simple property Classes

by Peter B. West

- Introduction
- Common data
- Accessing property Data Constants

### Introduction

An overview of the properties and classes involved in handling properties has already been given. This discussion will go in detail into the way data are represented within properties. Iit is important to keep in mind that the primary avenue of access to the data and the methods of property classes is the PropertyConsts class and its singleton object.

### Common data

org.apache.fop.fo.properties.Character is an example of a basic property class. The data fields common to all properties are:

final int dataTypes
  This field defines the allowable data types which may be assigned to the property. The value is chosen from the data type constants defined in org.apache.fop.fo.properties.Property, and may consist of more than one of those constants, bit-ORed together.
final int traitMapping
  This field defines the mapping of properties to traits in the Area tree. The value is chosen from the trait mapping constants defined in org.apache.fop.fo.properties.Property, and may consist of more than one of those constants, bit-ORed together.
final int initialValueType
  This field defines the data type of the initial value assigned to the property. The value is chosen from the initial value type constants defined in org.apache.fop.fo.properties.Property. In the simplest property classes, such as Character, there is no defined initial value type.
final int inherited
  This field defines the kind of inheritance applicable to the property. The value is chosen from the inheritance constants defined in org.apache.fop.fo.properties.Property.

### Accessing property Data Constants

The constants above are generally accessed through the arrays maintained in the PropertyConsts singleton pconsts. The first invocation of the method setupProperty on the property generates a Class instance for the class, and stores it in the array classes. This Class object is used, in turn, to instantiate the singleton instance of the class, which is stored in the Property[] properties array of pconsts.

Reflection methods are then used, via the same Class instance, to extract and store the static data fields. These arrays and associated access methods are:

int[] datatypes
  int getDataTypes(int)
int[] traitMappings
  No access method yet defined.
int[] initialValueTypes
  int getInitialValueType(int)
int[] inherited
  int inheritance(int)

Previous: PropertyConsts class

Next: getInitialValue()