Class PathFactoryImpl
- java.lang.Object
-
- org.apache.jackrabbit.spi.commons.name.PathFactoryImpl
-
- All Implemented Interfaces:
PathFactory
public class PathFactoryImpl extends Object implements PathFactory
PathFactoryImpl
...
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Path
create(String pathString)
Returns aPath
holding the value of the specified string.Path
create(Name name)
Creates a relative path based on aName
.Path
create(Name name, int index)
Creates a relative path based on aName
and a normalized index.Path
create(Path.Element element)
Creates a path from the given element.Path
create(Path.Element[] elements)
Create a newPath
from the given elements.Path
create(Path parent, Name name, boolean normalize)
Creates a newPath
out of the givenparent
path and the give name.Path
create(Path parent, Name name, int index, boolean normalize)
Creates a newPath
out of the givenparent
path and the give name and normalized index.Path
create(Path parent, Path relPath, boolean normalize)
Return a newPath
out of the givenparent
path and the given relative path.Path.Element
createElement(String identifier)
Creates a path element from the givenidentifier
.Path.Element
createElement(Name name)
Creates a path element from the givenname
.Path.Element
createElement(Name name, int index)
Same asPathFactory.createElement(Name)
except that an explicit index can be specified.Path.Element
getCurrentElement()
Return the current element.static PathFactory
getInstance()
Path.Element
getParentElement()
Return the parent element.Path.Element
getRootElement()
Return the root element.Path
getRootPath()
Return thePath
of the root node.
-
-
-
Method Detail
-
getInstance
public static PathFactory getInstance()
-
create
public Path create(Path parent, Path relPath, boolean normalize) throws IllegalArgumentException, RepositoryException
Description copied from interface:PathFactory
Return a newPath
out of the givenparent
path and the given relative path. Ifnormalize
istrue
, the returned path will be normalized (or canonicalized, if the parent path is absolute).- Specified by:
create
in interfacePathFactory
- Returns:
- Throws:
IllegalArgumentException
- ifrelPath
is absolute.RepositoryException
- If thenormalized
istrue
and the resulting path cannot be normalized.- See Also:
PathFactory.create(Path, Path, boolean)
-
create
public Path create(Path parent, Name name, boolean normalize) throws RepositoryException
Description copied from interface:PathFactory
Creates a newPath
out of the givenparent
path and the give name. Ifnormalize
istrue
, the returned path will be normalized (or canonicalized, if the parent path is absolute). UsePathFactory.create(Path, Name, int, boolean)
in order to build aPath
having an index with his name element.- Specified by:
create
in interfacePathFactory
- Parameters:
parent
- the parent pathname
- the name of the new path element.normalize
- If true the Path is normalized before being returned.- Returns:
- Throws:
RepositoryException
- If thenormalized
istrue
and the resulting path cannot be normalized.- See Also:
PathFactory.create(Path, Name, boolean)
-
create
public Path create(Path parent, Name name, int index, boolean normalize) throws IllegalArgumentException, RepositoryException
Description copied from interface:PathFactory
Creates a newPath
out of the givenparent
path and the give name and normalized index. See alsoPathFactory.create(Path, Name, boolean)
.- Specified by:
create
in interfacePathFactory
- Parameters:
parent
- the parent path.name
- the name of the new path element.index
- the index of the new path element.normalize
- If true the Path is normalized before being returned.- Returns:
- Throws:
IllegalArgumentException
- If the given index is lower thanPath.INDEX_UNDEFINED
.RepositoryException
- If thenormalized
istrue
and the resulting path cannot be normalized.- See Also:
PathFactory.create(Path, Name, int, boolean)
-
create
public Path create(Name name) throws IllegalArgumentException
Description copied from interface:PathFactory
Creates a relative path based on aName
.- Specified by:
create
in interfacePathFactory
- Parameters:
name
- singleName
for this relative path.- Returns:
- the relative path created from
name
. - Throws:
IllegalArgumentException
- if the name isnull
.- See Also:
PathFactory.create(Name)
-
create
public Path create(Name name, int index) throws IllegalArgumentException
Description copied from interface:PathFactory
Creates a relative path based on aName
and a normalized index. Same asPathFactory.create(Name)
but allows to explicitly specify an index.- Specified by:
create
in interfacePathFactory
- Parameters:
name
- singleName
for this relative path.index
- index of the single name element.- Returns:
- the relative path created from
name
andnormalizedIndex
. - Throws:
IllegalArgumentException
- ifindex
is lower thanPath.INDEX_UNDEFINED
or if the name is not valid.- See Also:
PathFactory.create(Name, int)
-
create
public Path create(Path.Element element)
Description copied from interface:PathFactory
Creates a path from the given element.- Specified by:
create
in interfacePathFactory
- Parameters:
element
- path element- Returns:
- the created path
-
create
public Path create(Path.Element[] elements) throws IllegalArgumentException
Description copied from interface:PathFactory
Create a newPath
from the given elements.- Specified by:
create
in interfacePathFactory
- Returns:
- the
Path
created from the elements. - Throws:
IllegalArgumentException
- If the given elements arenull
or have a length of 0 or would otherwise constitute an invalid path.- See Also:
PathFactory.create(org.apache.jackrabbit.spi.Path.Element[])
-
create
public Path create(String pathString) throws IllegalArgumentException
Description copied from interface:PathFactory
Returns aPath
holding the value of the specified string. The string must be in the format returned by thePath.getString()
method.- Specified by:
create
in interfacePathFactory
- Parameters:
pathString
- aString
containing thePath
representation to be parsed.- Returns:
- the
Path
represented by the argument - Throws:
IllegalArgumentException
- if the specified string can not be parsed as aPath
.- See Also:
PathFactory.create(String)
-
createElement
public Path.Element createElement(Name name) throws IllegalArgumentException
Description copied from interface:PathFactory
Creates a path element from the givenname
. The created path element does not contain an explicit index.If the specified name denotes a special path element (either
PathFactory.getParentElement()
,PathFactory.getCurrentElement()
orPathFactory.getRootElement()
) then the associated constant is returned.- Specified by:
createElement
in interfacePathFactory
- Parameters:
name
- the name of the element- Returns:
- a path element
- Throws:
IllegalArgumentException
- if the name isnull
- See Also:
PathFactory.createElement(Name)
-
createElement
public Path.Element createElement(Name name, int index) throws IllegalArgumentException
Description copied from interface:PathFactory
Same asPathFactory.createElement(Name)
except that an explicit index can be specified.Note that an IllegalArgumentException will be thrown if the specified name denotes a special path element (either
PathFactory.getParentElement()
,PathFactory.getCurrentElement()
orPathFactory.getRootElement()
) since an explicit index is not allowed in this context.- Specified by:
createElement
in interfacePathFactory
- Parameters:
name
- the name of the elementindex
- the index if the element.- Returns:
- a path element
- Throws:
IllegalArgumentException
- if the name isnull
, if the given index is lower thanPath.INDEX_UNDEFINED
or if name denoting a special path element.- See Also:
PathFactory.createElement(Name, int)
-
createElement
public Path.Element createElement(String identifier) throws IllegalArgumentException
Description copied from interface:PathFactory
Creates a path element from the givenidentifier
.- Specified by:
createElement
in interfacePathFactory
- Parameters:
identifier
- Node identifier for which the path element should be created.- Returns:
- a path element.
- Throws:
IllegalArgumentException
- If theidentifier
isnull
.
-
getCurrentElement
public Path.Element getCurrentElement()
Description copied from interface:PathFactory
Return the current element.- Specified by:
getCurrentElement
in interfacePathFactory
- Returns:
- the current element.
- See Also:
PathFactory.getCurrentElement()
-
getParentElement
public Path.Element getParentElement()
Description copied from interface:PathFactory
Return the parent element.- Specified by:
getParentElement
in interfacePathFactory
- Returns:
- the parent element.
- See Also:
PathFactory.getParentElement()
-
getRootElement
public Path.Element getRootElement()
Description copied from interface:PathFactory
Return the root element.- Specified by:
getRootElement
in interfacePathFactory
- Returns:
- the root element.
- See Also:
PathFactory.getRootElement()
-
getRootPath
public Path getRootPath()
Description copied from interface:PathFactory
Return thePath
of the root node.- Specified by:
getRootPath
in interfacePathFactory
- Returns:
- the
Path
of the root node. - See Also:
PathFactory.getRootPath()
-
-