Class AbstractProperty
- java.lang.Object
- 
- org.apache.jackrabbit.commons.AbstractItem
- 
- org.apache.jackrabbit.commons.AbstractProperty
 
 
- 
- Direct Known Subclasses:
- StaleProperty
 
 public abstract class AbstractProperty extends AbstractItem implements Item, Property Abstract base class for implementing the JCRPropertyinterface.Itemmethods without a default implementation:- Item.getName()
- Item.getParent()
- Item.getSession()
- Item.isModified()
- Item.isNew()
- Item.isSame(Item)
- Item.refresh(boolean)
- Item.save()
 Propertymethods without a default implementation: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.
- 
- 
Field Summary- 
Fields inherited from interface javax.jcr.PropertyJCR_ACTIVITY, JCR_AUTOCREATED, JCR_BASE_VERSION, JCR_CHILD_VERSION_HISTORY, JCR_CONFIGURATION, JCR_CONTENT, JCR_COPIED_FROM, JCR_CREATED, JCR_CREATED_BY, JCR_CURRENT_LIFECYCLE_STATE, JCR_DATA, JCR_DEFAULT_PRIMARY_TYPE, JCR_DEFAULT_VALUES, JCR_DESCRIPTION, JCR_ENCODING, JCR_FROZEN_MIXIN_TYPES, JCR_FROZEN_PRIMARY_TYPE, JCR_FROZEN_UUID, JCR_HAS_ORDERABLE_CHILD_NODES, JCR_HOST, JCR_ID, JCR_IS_ABSTRACT, JCR_IS_CHECKED_OUT, JCR_IS_MIXIN, JCR_LANGUAGE, JCR_LAST_MODIFIED, JCR_LAST_MODIFIED_BY, JCR_LIFECYCLE_POLICY, JCR_LOCK_IS_DEEP, JCR_LOCK_OWNER, JCR_MANDATORY, JCR_MERGE_FAILED, JCR_MIMETYPE, JCR_MIXIN_TYPES, JCR_MULTIPLE, JCR_NAME, JCR_NODE_TYPE_NAME, JCR_ON_PARENT_VERSION, JCR_PATH, JCR_PORT, JCR_PREDECESSORS, JCR_PRIMARY_ITEM_NAME, JCR_PRIMARY_TYPE, JCR_PROTECTED, JCR_PROTOCOL, JCR_REPOSITORY, JCR_REQUIRED_PRIMARY_TYPES, JCR_REQUIRED_TYPE, JCR_ROOT, JCR_SAME_NAME_SIBLINGS, JCR_STATEMENT, JCR_SUCCESSORS, JCR_SUPERTYPES, JCR_TITLE, JCR_UUID, JCR_VALUE_CONSTRAINTS, JCR_VERSION_HISTORY, JCR_VERSIONABLE_UUID, JCR_WORKSPACE
 
- 
 - 
Constructor SummaryConstructors Constructor Description AbstractProperty()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(ItemVisitor visitor)Accepts the given item visitor.booleangetBoolean()Returns the boolean value of this property.CalendargetDate()Returns the date value of this property.doublegetDouble()Returns the double value of this property.longgetLength()Returns the length of the value of this property.long[]getLengths()Returns the lengths of the values of this property.longgetLong()Returns the long value of this property.NodegetNode()If this property is of typeREFERENCE,WEAKREFERENCEorPATH(or convertible to one of these types) this method returns theNodeto which this property refers.StringgetPath()Returns the path of this property.PropertygetProperty()If this property is of typePATH(or convertible to this type) this method returns thePropertyto which this property refers.InputStreamgetStream()Returns the binary value of this property.StringgetString()Returns the string value of this property.intgetType()Returns the type of this property.booleanisNode()Returnsfalse.voidremove()Removes this property.voidsetValue(boolean value)Sets the value of this property.voidsetValue(double value)Sets the value of this property.voidsetValue(long value)Sets the value of this property.voidsetValue(InputStream value)Sets the value of this property.voidsetValue(String value)Sets the value of this property.voidsetValue(String[] values)Sets the values of this property.voidsetValue(Calendar value)Sets the value of this property.voidsetValue(Node value)Sets the value of this property.voidsetValue(Value value)Sets the value of this property.voidsetValue(Value[] values)Sets the values of this property.- 
Methods inherited from class org.apache.jackrabbit.commons.AbstractItemgetAncestor, getDepth, toString
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface javax.jcr.ItemgetAncestor, getDepth, getName, getParent, getSession, isModified, isNew, isSame, refresh, save
 - 
Methods inherited from interface javax.jcr.PropertygetBinary, getDecimal, getDefinition, getValue, getValues, isMultiple, setValue, setValue
 
- 
 
- 
- 
- 
Method Detail- 
acceptpublic void accept(ItemVisitor visitor) throws RepositoryException Accepts the given item visitor.The default implementation calls ItemVisitor.visit(Property)on the given visitor with this property as the argument.- Specified by:
- acceptin interface- Item
- Parameters:
- visitor- item visitor
- Throws:
- RepositoryException- if an error occurs
 
 - 
getPathpublic String getPath() throws RepositoryException Returns the path of this property.The default implementation constructs the path from the path of the parent node and the name of this property. - Specified by:
- getPathin interface- Item
- Returns:
- property path
- Throws:
- RepositoryException- if an error occurs
 
 - 
removepublic void remove() throws RepositoryExceptionRemoves this property.The default implementation calls Node.setProperty(String, Value)with anullvalue on the parent node.- Specified by:
- removein interface- Item
- Throws:
- RepositoryException- if an error occurs
 
 - 
getBooleanpublic boolean getBoolean() throws RepositoryExceptionReturns the boolean value of this property.The default implementation forwards the method call to the Valueinstance returned by the genericProperty.getValue()method.- Specified by:
- getBooleanin interface- Property
- Returns:
- boolean value
- Throws:
- RepositoryException- if an error occurs
 
 - 
getDatepublic Calendar getDate() throws RepositoryException Returns the date value of this property.The default implementation forwards the method call to the Valueinstance returned by the genericProperty.getValue()method.- Specified by:
- getDatein interface- Property
- Returns:
- date value
- Throws:
- RepositoryException- if an error occurs
 
 - 
getDoublepublic double getDouble() throws RepositoryExceptionReturns the double value of this property.The default implementation forwards the method call to the Valueinstance returned by the genericProperty.getValue()method.- Specified by:
- getDoublein interface- Property
- Returns:
- double value
- Throws:
- RepositoryException- if an error occurs
 
 - 
getLengthpublic long getLength() throws RepositoryExceptionReturns the length of the value of this property.The default implementation measures the length of the Valueinstance returned by the genericProperty.getValue()method.- Specified by:
- getLengthin interface- Property
- Returns:
- length of the property value
- Throws:
- RepositoryException- if an error occurs
 
 - 
getLengthspublic long[] getLengths() throws RepositoryExceptionReturns the lengths of the values of this property.The default implementation measures the lengths of the Valueinstances returned by the genericProperty.getValues()method.- Specified by:
- getLengthsin interface- Property
- Returns:
- lengths of the property values
- Throws:
- RepositoryException- if an error occurs
 
 - 
getLongpublic long getLong() throws RepositoryExceptionReturns the long value of this property.The default implementation forwards the method call to the Valueinstance returned by the genericProperty.getValue()method.- Specified by:
- getLongin interface- Property
- Returns:
- long value
- Throws:
- RepositoryException- if an error occurs
 
 - 
getNodepublic Node getNode() throws ValueFormatException, RepositoryException If this property is of typeREFERENCE,WEAKREFERENCEorPATH(or convertible to one of these types) this method returns theNodeto which this property refers.If this property is of type PATHand 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.- Specified by:
- getNodein interface- Property
- Returns:
- the referenced Node
- Throws:
- ValueFormatException- if this property cannot be converted to a referring type (- REFERENCE,- WEAKREFERENCEor- 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- PATHor- WEAKREFERENCEand no target node accessible by the current- Sessionexists in this workspace. Note that this applies even if the property is a- PATHSand a property exists at the specified location. To dereference to a target property (as opposed to a target node), the method- Property.getPropertyis used.
- RepositoryException- if another error occurs.
 
 - 
getPropertypublic Property getProperty() throws RepositoryException If this property is of typePATH(or convertible to this type) this method returns thePropertyto 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/cand it has a value of "../d" then this method will return the property at/a/dif such exists.If this property is multi-valued, this method throws a ValueFormatException.If this property cannot be converted to a PATHthen aValueFormatExceptionis thrown.If this property is currently part of the frozen state of a version in version storage, this method will throw a ValueFormatException.- Specified by:
- getPropertyin interface- Property
- Returns:
- 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 type but is currently part of the frozen state of a version in version storage.
- ItemNotFoundException- If no property accessible by the current- Sessionexists 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.getNodeis used.
- RepositoryException- if another error occurs.
 
 - 
getStreampublic InputStream getStream() throws RepositoryException Returns the binary value of this property.The default implementation forwards the method call to the Valueinstance returned by the genericProperty.getValue()method.- Specified by:
- getStreamin interface- Property
- Returns:
- binary value
- Throws:
- RepositoryException- if an error occurs
 
 - 
getStringpublic String getString() throws RepositoryException Returns the string value of this property.The default implementation forwards the method call to the Valueinstance returned by the genericProperty.getValue()method.- Specified by:
- getStringin interface- Property
- Returns:
- string value
- Throws:
- RepositoryException- if an error occurs
 
 - 
getTypepublic int getType() throws RepositoryExceptionReturns the type of this property.The default implementation forwards the method call to the Valueinstance returned by the genericProperty.getValue()method.- Specified by:
- getTypein interface- Property
- Returns:
- property type
- Throws:
- RepositoryException- if an error occurs
 
 - 
setValuepublic void setValue(Value value) throws RepositoryException Sets the value of this property.The default implementation forwards the call to the Node.setProperty(String, Value)method of the parent node using the name of this property.- Specified by:
- setValuein interface- Property
- Parameters:
- value- passed through
- Throws:
- RepositoryException- if an error occurs
 
 - 
setValuepublic void setValue(Value[] values) throws RepositoryException Sets the values of this property.The default implementation forwards the call to the Node.setProperty(String, Value[])method of the parent node using the name of this property.- Specified by:
- setValuein interface- Property
- Parameters:
- values- passed through
- Throws:
- RepositoryException- if an error occurs
 
 - 
setValuepublic void setValue(String value) throws RepositoryException Sets the value of this property.The default implementation forwards the call to the Node.setProperty(String, String)method of the parent node using the name of this property.- Specified by:
- setValuein interface- Property
- Parameters:
- value- passed through
- Throws:
- RepositoryException- if an error occurs
 
 - 
setValuepublic void setValue(String[] values) throws RepositoryException Sets the values of this property.The default implementation forwards the call to the Node.setProperty(String, String[])method of the parent node using the name of this property.- Specified by:
- setValuein interface- Property
- Parameters:
- values- passed through
- Throws:
- RepositoryException- if an error occurs
 
 - 
setValuepublic void setValue(InputStream value) throws RepositoryException Sets the value of this property.The default implementation forwards the call to the Node.setProperty(String, InputStream)method of the parent node using the name of this property.- Specified by:
- setValuein interface- Property
- Parameters:
- value- passed through
- Throws:
- RepositoryException- if an error occurs
 
 - 
setValuepublic void setValue(long value) throws RepositoryExceptionSets the value of this property.The default implementation forwards the call to the Node.setProperty(String, long)method of the parent node using the name of this property.- Specified by:
- setValuein interface- Property
- Parameters:
- value- passed through
- Throws:
- RepositoryException- if an error occurs
 
 - 
setValuepublic void setValue(double value) throws RepositoryExceptionSets the value of this property.The default implementation forwards the call to the Node.setProperty(String, double)method of the parent node using the name of this property.- Specified by:
- setValuein interface- Property
- Parameters:
- value- passed through
- Throws:
- RepositoryException- if an error occurs
 
 - 
setValuepublic void setValue(Calendar value) throws RepositoryException Sets the value of this property.The default implementation forwards the call to the Node.setProperty(String, Calendar)method of the parent node using the name of this property.- Specified by:
- setValuein interface- Property
- Parameters:
- value- passed through
- Throws:
- RepositoryException- if an error occurs
 
 - 
setValuepublic void setValue(boolean value) throws RepositoryExceptionSets the value of this property.The default implementation forwards the call to the Node.setProperty(String, boolean)method of the parent node using the name of this property.- Specified by:
- setValuein interface- Property
- Parameters:
- value- passed through
- Throws:
- RepositoryException- if an error occurs
 
 - 
setValuepublic void setValue(Node value) throws RepositoryException Sets the value of this property.The default implementation forwards the call to the Node.setProperty(String, Node)method of the parent node using the name of this property.- Specified by:
- setValuein interface- Property
- Parameters:
- value- passed through
- Throws:
- RepositoryException- if an error occurs
 
 
- 
 
-