|
Oracle® Database XML Java API Reference 11g Release 2 (11.2) E10769-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PropertyDefinition
A property definition. Used in node type definitions.
Method Summary | |
---|---|
Value[] |
getDefaultValues() Gets the default value(s) of the property. |
int |
getRequiredType() Gets the required type of the property. |
java.lang.String[] |
getValueConstraints() Gets the array of constraint strings. |
boolean |
isMultiple() Reports whether this property can have multiple values. |
Methods inherited from interface javax.jcr.nodetype.ItemDefinition |
---|
getDeclaringNodeType, getName, getOnParentVersion, isAutoCreated, isMandatory, isProtected |
Method Detail |
---|
int getRequiredType()
PropertyType.STRING
PropertyType.DATE
PropertyType.BINARY
PropertyType.DOUBLE
PropertyType.LONG
PropertyType.BOOLEAN
PropertyType.NAME
PropertyType.PATH
PropertyType.REFERENCE
PropertyType.UNDEFINED
PropertyType.UNDEFINED
is returned if this property may be of any type.java.lang.String[] getValueConstraints()
["constraint1", "constraint2", "constraint3"]
has the interpretation: "the value of this property must meet either constraint1, constraint2 or constraint3".
Reporting of value constraints is optional. An implementation may return null
, indicating that value constraint information is unavailable (though a constraint may still exist). <p/> Returning an empty array, on the other hand, indicates that value constraint information is available and that no constraints are placed on this value.
In the case of multi-value properties, the constraint string array returned applies to all the values of the property.
The constraint strings themselves having differing formats and interpretations depending on the type of the property in question. The following describes the value constraint syntax for each property type:
STRING
: The constraint string is a regular expression pattern. For example the regular expression ".*
" means "any string, including the empty string". Whereas a simple literal string (without any RE-specific meta-characters) like "banana
" matches only the string "banana
".PATH
: The constraint string is a JCR path with an optional "*
" character after the last "/
" character. For example, possible constraint strings for a property of type PATH
include:
/myapp:products/myapp:televisions
"/myapp:products/myapp:televisions/
"/myapp:products/*
"myapp:products/myapp:televisions
"../myapp:televisions
"../myapp:televisions/*
"/a/*
does not match /a/../c
. The constraint must match the normalized path./
" has no effect (hence, 1
and 2
, above, are equivalent).*
" character means that the value of the PATH
property is restricted to the indicated subtree (in other words any additional relative path can replace the "*
"). For example, 3, above would allow /myapp:products/myapp:radios
, /myapp:products/myapp:microwaves/X900
, and so forth.*
" means that the PATH
property is restricted to that precise path. For example, 1
, above, would allow only the value /myapp:products/myapp:televisions
./
" character. 1
and 4
, above for example, are distinct.Session
(i.e., the current state of the namespace registry overlaid with any session-specific mappings). Constraint strings for PATH
properties should be stored in fully-qualified form (using the actual URI instead of the prefix) and then be converted to prefix form according to the current mapping upon the PropertyDefinition.getValueConstraints
call.NAME
: The constraint string is a JCR name in prefix form. For example "myapp:products
". No wildcards or other pattern matching are supported. As with PATH
properties, the string returned must reflect the namespace mapping in the current Session
. Constraint strings for NAME
properties should be stored in fully-qualified form (using the actual URI instead of the prefix) and then be converted to prefix form according to the current mapping.REFERENCE
: The constraint string is a JCR name in prefix form. This name is interpreted as a node type name and the REFERENCE
property is restricted to referring only to nodes that have at least the indicated node type. For example, a constraint of "mytype:document
" would indicate that the REFERENCE property in question can only refer to nodes that have at least the node type mytype:document
(assuming this was the only constraint returned in the array, recall that the array of constraints are to be "OR-ed" together). No wildcards or other pattern matching are supported. As with PATH
properties, the string returned must reflect the namespace mapping in the current Session
. Constraint strings for REFERENCE
properties should be stored in fully-qualified form (using the actual URI instead of the prefix) and then be converted to prefix form according to the current mapping.BOOLEAN
: Either "true
" or "false
".[min, max]
", "(min, max)
", "(min, max]
" or "[min, max)
". Where "[
" and "]
" indicate "inclusive", while "(
" and ")
" indicate "exclusive". A missing min
or max
value indicates no bound in that direction. For example [,5] means no minimum but a maximum of 5 (inclusive) while [,] means simply that any value will suffice, The meaning of the min
and max
values themselves differ between types as follows:
BINARY
: min
and max
specify the allowed size range of the binary value in bytes.DATE
: min
and max
are dates specifying the allowed date range. The date strings must be in the ISO8601-compliant format: YYYY-MM-DDThh:mm:ss.sssTZD
.LONG
, DOUBLE
: min and max are numbers.String
array.Value[] getDefaultValues()
ItemDefinition.isAutoCreated()
returns true
).
This method returns an array of Value objects. If the property is multi-valued, then this array represents the full set of values that the property will be assigned upon being auto-created. Note that this could be the empty array. If the property is single-valued, then the array returned will be of size 1. <p/> If null
is returned, then the property has no fixed default value. This does not exclude the possibility that the property still assumes some value automatically, but that value may be parameterized (for example, "the current date") and hence not expressable as a single fixed value. In particular, this must be the case if isAutoCreated
returns true
and this method returns null
.
Value
objects.boolean isMultiple()
isMultiple
flag is special in that a given node type may have two property definitions that are identical in every respect except for the their isMultiple
status. For example, a node type can specify two string properties both called X
, one of which is multi-valued and the other not.boolean
|
Oracle® Database XML Java API Reference 11g Release 2 (11.2) E10769-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |