public abstract class AbstractProperty extends AbstractItem
Property
interface.
Item
methods without a default implementation:
Item#getName()
Item#getParent()
Item#getSession()
Item#isModified()
Item#isNew()
Item#isSame(Item)
Item#refresh(boolean)
Item#save()
Property
methods without a default implementation:
Property#getDefinition()
Property#getValue()
Property#getValues()
NOTE: Many of the default method implementations in
this base class rely on the parent node being accessible through the
Item#getParent()
call. It is possible (though unlikely) that
access controls deny access to a containing node even though a property
is accessible. In such cases the default method implementations in this
class will not work.
Constructor and Description |
---|
AbstractProperty() |
Modifier and Type | Method and Description |
---|---|
void |
accept(ItemVisitor visitor)
Accepts the given item visitor.
|
boolean |
getBoolean()
Returns the boolean value of this property.
|
java.util.Calendar |
getDate()
Returns the date value of this property.
|
double |
getDouble()
Returns the double value of this property.
|
long |
getLength()
Returns the length of the value of this property.
|
long[] |
getLengths()
Returns the lengths of the values of this property.
|
long |
getLong()
Returns the long value of this property.
|
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. |
java.lang.String |
getPath()
Returns the path of this property.
|
Property |
getProperty()
If this property is of type
PATH (or convertible to this
type) this method returns the Property to which this
property refers. |
java.io.InputStream |
getStream()
Returns the binary value of this property.
|
java.lang.String |
getString()
Returns the string value of this property.
|
int |
getType()
Returns the type of this property.
|
boolean |
isNode()
Returns
false . |
void |
remove()
Removes this property.
|
void |
setValue(Node value)
Sets the value of this property.
|
void |
setValue(Value value)
Sets the value of this property.
|
void |
setValue(Value[] values)
Sets the values of this property.
|
getAncestor, getDepth, toString
public void accept(ItemVisitor visitor) throws RepositoryException
The default implementation calls ItemVisitor#visit(Property)
on the given visitor with this property as the argument.
visitor
- item visitorRepositoryException
- if an error occurspublic java.lang.String getPath() throws RepositoryException
The default implementation constructs the path from the path of the parent node and the name of this property.
RepositoryException
- if an error occurspublic boolean isNode()
false
.false
public void remove() throws RepositoryException
The default implementation calls Node#setProperty(String, Value)
with a null
value on the parent node.
RepositoryException
- if an error occurspublic boolean getBoolean() throws RepositoryException
The default implementation forwards the method call to the
Value
instance returned by the generic
Property#getValue()
method.
RepositoryException
- if an error occurspublic java.util.Calendar getDate() throws RepositoryException
The default implementation forwards the method call to the
Value
instance returned by the generic
Property#getValue()
method.
RepositoryException
- if an error occurspublic double getDouble() throws RepositoryException
The default implementation forwards the method call to the
Value
instance returned by the generic
Property#getValue()
method.
RepositoryException
- if an error occurspublic long getLength() throws RepositoryException
The default implementation measures the length of the Value
instance returned by the generic Property#getValue()
method.
RepositoryException
- if an error occurspublic long[] getLengths() throws RepositoryException
The default implementation measures the lengths of the Value
instances returned by the generic Property#getValues()
method.
RepositoryException
- if an error occurspublic long getLong() throws RepositoryException
The default implementation forwards the method call to the
Value
instance returned by the generic
Property#getValue()
method.
RepositoryException
- if an error occurspublic Node getNode() throws ValueFormatException, RepositoryException
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.
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 type but is currently part of the frozen state of a
version in version storage.ItemNotFoundException
- If this property is of type
PATH
or WEAKREFERENCE
and no target node
accessible by the current Session
exists in this workspace.
Note that this applies even if the property is a PATHS
and 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.RepositoryException
- if another error occurs.public Property getProperty() throws RepositoryException
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. Therefore, when resolving such a
relative path, the segment ".
" 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.
For example, if this property is located at
/a/b/c
and it has a value of "../d
" then this
method will return the property at /a/d
if such exists.
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
.
ValueFormatException
- if this property cannot be converted to a
PATH
, if the property is multi-valued or if this property is
a referring type but is currently part of the frozen state of a version
in version storage.ItemNotFoundException
- If no property accessible by the current
Session
exists in this workspace at the specified path. 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.RepositoryException
- if another error occurs.public java.io.InputStream getStream() throws RepositoryException
The default implementation forwards the method call to the
Value
instance returned by the generic
Property#getValue()
method.
RepositoryException
- if an error occurspublic java.lang.String getString() throws RepositoryException
The default implementation forwards the method call to the
Value
instance returned by the generic
Property#getValue()
method.
RepositoryException
- if an error occurspublic int getType() throws RepositoryException
The default implementation forwards the method call to the
Value
instance returned by the generic
Property#getValue()
method.
RepositoryException
- if an error occurspublic void setValue(Value value) throws RepositoryException
The default implementation forwards the call to the
Node#setProperty(String, Value)
method of the parent node
using the name of this property.
value
- passed throughRepositoryException
- if an error occurspublic void setValue(Value[] values) throws RepositoryException
The default implementation forwards the call to the
Node#setProperty(String, Value[])
method of the parent node
using the name of this property.
values
- passed throughRepositoryException
- if an error occurspublic void setValue(Node value) throws RepositoryException
The default implementation forwards the call to the
Node#setProperty(String, Node)
method of the parent node
using the name of this property.
value
- passed throughRepositoryException
- if an error occurs"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"