| javax.jcr.Property
Property | public interface Property extends Item(Code) | | A Property object represents the smallest granularity of content
storage. It has a single parent node and no children. A property consists of a
name and a value, or in the case of multi-value properties, a set of values
all of the same type. See
Value .
|
Method Summary | |
public Binary | getBinary() Returns a Binary representation of the value of this
property. | public boolean | getBoolean() Returns a boolean representation of the value of this
property. | public Calendar | getDate() Returns a Calendar representation of the value of this
property. | public BigDecimal | getDecimal() Returns a BigDecimal representation of the value of this
property. | public PropertyDefinition | getDefinition() Returns the property definition that applies to this property. | public double | getDouble() Returns a double representation of the value of this
property. | public long | getLength() Returns the length of the value of this property. | public long[] | getLengths() Returns an array holding the lengths of the values of this (multi-value) property in bytes
if the values are PropertyType.BINARY , otherwise it returns the number of
characters needed to display the value in its string form. | public long | getLong() Returns a long representation of the value of this
property. | public Node | getNode() If this property is of type REFERENCE , WEAKREFERENCE or PATH
(or convertible to one of these types) this method returns the Node to which this property refers.
If this property is of type PATH and it contains a relative path, it is interpreted relative to the
parent node of this property. | public Property | getProperty() If this property is of type PATH (or convertible to this type) this method returns the
Property to which this property refers.
If this property contains a relative path, it is interpreted relative to the parent node of this property.
For example ". " refers to the parent node itself, ".. " to the parent of the parent node
and "foo " to a sibling property of this property or this property itself.
If no property exists in this workspace at the specified path then an ItemNotFoundException is
thrown. | public InputStream | getStream() Returns an InputStream representation of the value of this
property. | public String | getString() Returns a String representation of the value of this
property. | public int | getType() Returns the type of this Property . | public Value | getValue() Returns the value of this property as a Value object.
If this property is multi-valued, this method throws a ValueFormatException .
The object returned is a copy of the stored value and is immutable.
throws: ValueFormatException - if the property is multi-valued. throws: RepositoryException - if another error occurs. | public Value[] | getValues() Returns an array of all the values of this property. | public void | setValue(Value value) Sets the value of this property to value .
If this property's property type is not constrained by the node type of
its parent node, then the property type is changed to that of the supplied
value . | public void | setValue(Value[] values) Sets the value of this property to the values array.
If this property's property type is not constrained by the node type of
its parent node, then the property type is changed to that of the supplied
values . | public void | setValue(String value) Sets the value of this property to value . | public void | setValue(String[] values) Sets the value of this property to the values array. | public void | setValue(InputStream value) Sets the value of this property to value . | public void | setValue(Binary value) Sets the value of this property to value . | public void | setValue(long value) Sets the value of this property to value . | public void | setValue(double value) Sets the value of this property to value . | public void | setValue(BigDecimal value) Sets the value of this property to value . | public void | setValue(Calendar value) Sets the value of this property to value . | public void | setValue(boolean value) Sets the value of this property to value . | public void | setValue(Node value) Sets this REFERENCE property to refer to the specified node. |
getBinary | public Binary getBinary() throws ValueFormatException, RepositoryException(Code) | | Returns a Binary representation of the value of this
property. A shortcut for
Property.getValue().getBinary() . See
Value .
It is the responsibility of the caller to close the returned InputStream.
If this property is multi-valued, this method throws a ValueFormatException .
A RepositoryException is thrown if another error occurs.
A stream representation of the value of this property. throws: ValueFormatException - if the property is multi-valued. throws: RepositoryException - if another error occurs since: JCR 2.0 |
getBoolean | public boolean getBoolean() throws ValueFormatException, RepositoryException(Code) | | Returns a boolean representation of the value of this
property. A shortcut for
Property.getValue().getBoolean() . See
Value .
If this property is multi-valued, this method throws a ValueFormatException .
If the value of this property cannot be converted to a boolean ,
a ValueFormatException is thrown.
A RepositoryException is thrown if another error occurs.
A boolean representation of the value of this property. throws: ValueFormatException - if conversion to a boolean isnot possible or if the property is multi-valued. throws: RepositoryException - if another error occurs |
getDate | public Calendar getDate() throws ValueFormatException, RepositoryException(Code) | | Returns a Calendar representation of the value of this
property. A shortcut for
Property.getValue().getDate() . See
Value .
The object returned is a copy of the stored value, so changes to it are not reflected in internal storage.
If this property is multi-valued, this method throws a ValueFormatException .
If the value of this property cannot be converted to a
Calendar , a ValueFormatException is thrown.
A RepositoryException is thrown if another error occurs.
A date (Calendar object) representation of the value of this property. throws: ValueFormatException - if conversion to a string is not possible or if theproperty is multi-valued. throws: RepositoryException - if another error occurs |
getDecimal | public BigDecimal getDecimal() throws ValueFormatException, RepositoryException(Code) | | Returns a BigDecimal representation of the value of this
property. A shortcut for
Property.getValue().getDecimal() . See
Value .
If this property is multi-valued, this method throws a ValueFormatException .
If the value of this property cannot be converted to a BigDecimal ,
a ValueFormatException is thrown.
A RepositoryException is thrown if another error occurs.
A BigDecimal representation of the value of this property. throws: ValueFormatException - if conversion to a BigDecimal is not possible or if the property is multi-valued. throws: RepositoryException - if another error occurs since: JCR 2.0 |
getDefinition | public PropertyDefinition getDefinition() throws RepositoryException(Code) | | Returns the property definition that applies to this property. In some cases there may appear to
be more than one definition that could apply to this node. However, it is assumed that upon
creation or change of this property, a single particular definition is chosen by the implementation.
It is that definition that this method returns. How this governing definition is selected upon property
creation or change from among others which may have been applicable is an implementation issue and is not
covered by this specification.
See Also: javax.jcr.nodetype.NodeType.getPropertyDefinitions throws: RepositoryException - if an error occurs. a PropertyDefinition object. |
getDouble | public double getDouble() throws ValueFormatException, RepositoryException(Code) | | Returns a double representation of the value of this
property. A shortcut for
Property.getValue().getDouble() . See
Value .
If this property is multi-valued, this method throws a ValueFormatException .
If the value of this property cannot be converted to a double ,
a ValueFormatException is thrown.
A RepositoryException is thrown if another error occurs.
A double representation of the value of this property. throws: ValueFormatException - if conversion to a double isnot possible or if the property is multi-valued. throws: RepositoryException - if another error occurs |
getLength | public long getLength() throws ValueFormatException, RepositoryException(Code) | | Returns the length of the value of this property.
Returns the length in bytes if the value is a
BINARY , otherwise it returns the number of
characters needed to display the value in its string form.
Returns -1 if the implementation cannot determine the length.
If this property is multi-valued, this method throws a ValueFormatException .
an long . throws: ValueFormatException - if this property is multi-valued. throws: RepositoryException - if another error occurs. |
getLengths | public long[] getLengths() throws ValueFormatException, RepositoryException(Code) | | Returns an array holding the lengths of the values of this (multi-value) property in bytes
if the values are PropertyType.BINARY , otherwise it returns the number of
characters needed to display the value in its string form. The order of the
length values corresponds to the order of the values in the property.
Returns a -1 in the appropriate position if the implementation cannot determine
the length of a value.
If this property is single-valued, this method throws a ValueFormatException .
A RepositoryException is thrown if another error occurs.
an array of lengths throws: ValueFormatException - if this property is single-valued. throws: RepositoryException - if another error occurs. |
getLong | public long getLong() throws ValueFormatException, RepositoryException(Code) | | Returns a long representation of the value of this
property. A shortcut for
Property.getValue().getLong() . See
Value .
If this property is multi-valued, this method throws a ValueFormatException .
If the value of this property cannot be converted to a
long , a ValueFormatException is thrown.
A RepositoryException is thrown if another error occurs.
A long representation of the value of this property. throws: ValueFormatException - if conversion to a long is notpossible or if the property is multi-valued. throws: RepositoryException - if another error occurs |
getNode | public Node getNode() throws ItemNotFoundException, ValueFormatException, RepositoryException(Code) | | If this property is of type REFERENCE , WEAKREFERENCE or PATH
(or convertible to one of these types) this method returns the Node to which this property refers.
If this property is of type PATH and it contains a relative path, it is interpreted relative to the
parent node of this property. For example ". " refers to the parent node itself, ".. " to
the parent of the parent node and "foo " to a sibling node of this property.
If this property is of type WEAKREFERENCE and no node exists in this workspace with the specified
UUID then an ItemNotFoundException is thrown.
If this property is of type PATH and no node accessible by the current Session exists
in this workspace at the specified path then an ItemNotFoundException is thrown. Note that this
applies even if a property exists at the specified location. To dereference to a target property (as
opposed to a target node), the method Property.getProperty is used.
If this property is multi-valued, this method throws a ValueFormatException .
If this property cannot be converted to a REFERENCE , WEAKREFERENCE or PATH
then a ValueFormatException is thrown.
If this property is currently part of the frozen state of a version in version storage, this method will throw a
ValueFormatException .
the referenced Node throws: ValueFormatException - if this property cannot be converted to a referring type (REFERENCE ,WEAKREFERENCE or PATH), if the property is multi-valued or if this property is a referring typebut is currently part of the frozen state of a version in version storage. throws: ItemNotFoundException - If this property is of type PATH and no node accessible by the current Session existsin this workspace at the specified path. throws: RepositoryException - if another error occurs |
getProperty | public Property getProperty() throws ItemNotFoundException, ValueFormatException, RepositoryException(Code) | | If this property is of type PATH (or convertible to this type) this method returns the
Property to which this property refers.
If this property contains a relative path, it is interpreted relative to the parent node of this property.
For example ". " refers to the parent node itself, ".. " to the parent of the parent node
and "foo " to a sibling property of this property or this property itself.
If no property exists in this workspace at the specified path then an ItemNotFoundException is
thrown. Note that this applies even if a node exists at the specified location. To dereference to a target
node, the method Property.getNode is used.
If this property is multi-valued, this method throws a ValueFormatException .
If this property cannot be converted to a PATH then a ValueFormatException is thrown.
If this property is currently part of the frozen state of a version in version storage, this method will throw a
ValueFormatException .
the referenced property throws: ValueFormatException - if this property cannot be converted to a PATH , if the property is multi-valued or if this property is a referring typebut is currently part of the frozen state of a version in version storage. throws: ItemNotFoundException - If this property is of type PATH and no property accessible by the current Session existsin this workspace at the specified path. throws: RepositoryException - if another error occurs since: JCR 2.0 |
getStream | public InputStream getStream() throws ValueFormatException, RepositoryException(Code) | | Returns an InputStream representation of the value of this
property. A shortcut for
Property.getValue().getStream() . See
Value .
It is the responsibility of the caller to close the returned InputStream.
If this property is multi-valued, this method throws a ValueFormatException .
A RepositoryException is thrown if another error occurs.
Property.getBinary() A stream representation of the value of this property. throws: ValueFormatException - if the property is multi-valued. throws: RepositoryException - if another error occurs |
getString | public String getString() throws ValueFormatException, RepositoryException(Code) | | Returns a String representation of the value of this
property. A shortcut for
Property.getValue().getString() . See
Value .
If this property is multi-valued, this method throws a ValueFormatException .
If the value of this property cannot be converted to a String ,
a ValueFormatException is thrown.
A RepositoryException is thrown if another error occurs.
A string representation of the value of this property. throws: ValueFormatException - if conversion to a String isnot possible or if the property is multi-valued. throws: RepositoryException - if another error occurs. |
getType | public int getType() throws RepositoryException(Code) | | Returns the type of this Property . One of:
PropertyType.STRING
PropertyType.BINARY
PropertyType.DATE
PropertyType.DOUBLE
PropertyType.LONG
PropertyType.BOOLEAN
PropertyType.NAME
PropertyType.PATH
PropertyType.REFERENCE
PropertyType.WEAKREFERENCE
PropertyType.URI
The type returned is that which was set at property creation. Note that for some property p ,
the type returned by p.getType() will differ from the type returned by
p.getDefinition.getRequiredType() only in the case where the latter returns UNDEFINED .
The type of a property instance is never UNDEFINED (it must always have some actual type).
an int throws: RepositoryException - if an error occurs |
getValues | public Value[] getValues() throws ValueFormatException, RepositoryException(Code) | | Returns an array of all the values of this property. Used to access
multi-value properties. If the property is single-valued, this method throws a
ValueFormatException . The array returned is a copy of the stored
values, so changes to it are not reflected in internal storage.
throws: ValueFormatException - if the property is single-valued. throws: RepositoryException - if another error occurs. a Value array |
setValue | public void setValue(Value value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException(Code) | | Sets the value of this property to value .
If this property's property type is not constrained by the node type of
its parent node, then the property type is changed to that of the supplied
value . If the property type is constrained, then a
best-effort conversion is attempted. If conversion fails, a
ValueFormatException is thrown immediately (not on save ).
The change will be persisted (if valid) on save
A ConstraintViolationException will be thrown either immediately
or on save , if the change would violate a node type or implementation-specific constraint.
Implementations may differ on when this validation is performed.
A VersionException will be thrown either immediately
or on save , if this property belongs to a node that is versionable and
checked-in or is non-versionable but whose nearest versionable ancestor is checked-in.
Implementations may differ on when this validation is performed.
A LockException will be thrown either immediately
or on save , if a lock prevents the setting of the value.
Implementations may differ on when this validation is performed.
Parameters: value - The new value to set the property to. throws: ValueFormatException - if the type or format of the specified valueis incompatible with the type of this property. throws: VersionException - if this property belongs to a node that is versionable and checked-inor is non-versionable but whose nearest versionable ancestor is checked-in and thisimplementation performs this validation immediately instead of waiting until save . throws: LockException - if a lock prevents the setting of the value and thisimplementation performs this validation immediately instead of waiting until save . throws: ConstraintViolationException - if the change would violate a node-type or other constraintand this implementation performs this validation immediately instead of waiting until save . throws: RepositoryException - if another error occurs. |
setValue | public void setValue(Value[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException(Code) | | Sets the value of this property to the values array.
If this property's property type is not constrained by the node type of
its parent node, then the property type is changed to that of the supplied
values . If the property type is constrained, then a
best-effort conversion is attempted. If conversion fails, a
ValueFormatException is thrown immediately (not on save ).
If this property is not a multi-valued then a ValueFormatException is
thrown immediately. The change will be persisted (if valid) on save .
A ConstraintViolationException will be thrown either immediately
or on save , if the change would violate a node type or implementation-specific constraint.
Implementations may differ on when this validation is performed.
A VersionException will be thrown either immediately
or on save , if this property belongs to a node that is versionable and
checked-in or is non-versionable but whose nearest versionable ancestor is checked-in.
Implementations may differ on when this validation is performed.
A LockException will be thrown either immediately
or on save , if a lock prevents the setting of the value.
Implementations may differ on when this validation is performed.
Parameters: values - The new values to set the property to. throws: ValueFormatException - if the type or format of the specified valuesis incompatible with the type of this property. throws: VersionException - if this property belongs to a node that is versionable and checked-inor is non-versionable but whose nearest versionable ancestor is checked-in and thisimplementation performs this validation immediately instead of waiting until save . throws: LockException - if a lock prevents the setting of the value and thisimplementation performs this validation immediately instead of waiting until save . throws: ConstraintViolationException - if the change would violate a node-type or other constraintand this implementation performs this validation immediately instead of waiting until save . throws: RepositoryException - if another error occurs. |
setValue | public void setValue(Node value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException(Code) | | Sets this REFERENCE property to refer to the specified node. If
this property is not of type REFERENCE or the specified node is
not referenceable (i.e., is not of mixin node type
mix:referenceable and therefore does not have a UUID) then a
ValueFormatException is thrown.
Parameters: value - The node to which this REFERENCE property will refer. throws: ValueFormatException - if the type or format of the specified valueis incompatible with the type of this property. throws: VersionException - if this property belongs to a node that is versionable and checked-inor is non-versionable but whose nearest versionable ancestor is checked-in and thisimplementation performs this validation immediately instead of waiting until save . throws: LockException - if a lock prevents the setting of the value and thisimplementation performs this validation immediately instead of waiting until save . throws: ConstraintViolationException - if the change would violate a node-type or other constraintand this implementation performs this validation immediately instead of waiting until save . throws: RepositoryException - if another error occurs. |
|
|