public abstract class AbstractItem
extends java.lang.Object
Item
interface.
Item
methods without a default implementation:
Item#accept(javax.jcr.ItemVisitor)
Item#getName()
Item#getParent()
Item#getPath()
Item#getSession()
Item#isModified()
Item#isNew()
Item#isNode()
Item#isSame(Item)
Item#refresh(boolean)
Item#remove()
Item#save()
Constructor and Description |
---|
AbstractItem() |
Modifier and Type | Method and Description |
---|---|
Item |
getAncestor(int depth)
Returns the ancestor of this item at the given depth.
|
int |
getDepth()
Returns the depth of this item.
|
java.lang.String |
toString()
Returns a string representation of this item.
|
public Item getAncestor(int depth) throws ItemNotFoundException, AccessDeniedException, RepositoryException
The default implementation handles the root node at depth zero and
this item at depth equal to the depth of this item as special cases,
and uses javax.jcr.Session#getItem(String)
to retrieve other
ancestors based on the ancestor path calculated from the path of this
node as returned by Item#getPath()
.
depth
- depth of the returned ancestor itemItemNotFoundException
- if the given depth is negative or greater
than the depth of this itemAccessDeniedException
- if access to the ancestor item is deniedRepositoryException
- if an error occurspublic int getDepth() throws RepositoryException
The default implementation determines the depth by counting the
slashes in the path returned by Item#getPath()
.
RepositoryException
- if an error occurspublic java.lang.String toString()
The default implementation returns the path of this item and falls
back to the Object.toString()
implementation if the item path
can not be retrieved.
toString
in class java.lang.Object
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"