6.2.5 Property Types

The class PropertyType defines integer constants for the available property types as well as for their standardized type names (used in serialization) and two methods for converting back and forth between name and integer value:

javax.jcr.
PropertyType

int

STRING

The STRING property type is used to store strings. It has the same characteristics as the Java String class.

int

BINARY

BINARY properties are used to store binary data.

int

LONG

The LONG property type is used to store integers. It has the same characteristics as the Java primitive type long.

int

DOUBLE

The DOUBLE property type is used to store floating point numbers. It has the same characteristics as the Java primitive type double.

int

BOOLEAN

The BOOLEAN property type is used to store boolean values. It has the same characteristics as the Java primitive type boolean.

int

DATE

The DATE property type is used to store time and date information. See 6.2.5.1 Date.

int

NAME

A NAME is a pairing of a namespace and a local name. When read, the namespace is mapped to the current prefix. See 6.2.5.2 Name.

int

PATH

A PATH property is an ordered list of path elements. A path element is a NAME with an optional index. When read, the NAMEs within the path are mapped to their current prefix. A path may be absolute or relative. See 6.2.5.3 Path.

int

REFERENCE

A REFERENCE property stores the UUID of a referenceable node (one having type mix:referenceable), which must exist within the same workspace or session as the REFERENCE property. A REFERENCE property enforces this referential integrity by preventing (in level 2 implementations) the removal of its target node. See 6.2.5.4 Reference.

int

UNDEFINED

This constant can be used within a property definition (see 6.7.6 Property Definitions) to specify that the property in question may be of any type. However, it cannot be the actual type of any property instance. For example it will never be returned by Property.getType and (in level 2 implementations) it cannot be assigned as the type when creating a new property.

String

TYPENAME_STRING == "String"

TYPENAME_BINARY == "Binary"

TYPENAME_LONG == "Long"

TYPENAME_DOUBLE == "Double"

TYPENAME_DATE == "Date"

TYPENAME_BOOLEAN == "Boolean"

TYPENAME_NAME == "Name"

TYPENAME_PATH == "Path"

TYPENAME_REFERENCE == "Reference"

TYPENAME_UNDEFINED == "Undefined"

These constants define the standard string forms of the property types. These are used, for example, when serializing content to XML. See 6.4 XML Mappings.

String

nameFromValue(int type)

Returns the standard name of the given property type, specified by its integer value.

int

valueFromName(String name)

Returns the integer value of the given property type, specified by its standard name.