|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openmdx.compatibility.base.naming.Path
public final class Path
The Path class reperesents a data provider path. The components of a name are numbered. The indexes of a name with N components range from 0 up to, but not including, N. This range may be written as [0,N). The most significant component is at index 0. An empty name has no components. None of the methods in this interface accept null as a valid value for a parameter that is a name or a name component. Likewise, methods that return a name or name component never return null. An instance of a Path is not synchronized against concurrent multithreaded access if that access is not read-only.
| Field Summary | |
|---|---|
static String |
URI_SCHEME
Deprecated. use org.openmdx.kernel.uri.scheme.OpenMDXSchemes.URI_SCHEME |
| Constructor Summary | |
|---|---|
Path(Path path)
Creates a Path object. |
|
Path(String charSequence)
Creates a Path object. |
|
Path(String[] components)
Creates a new path object given by multiple path components. |
|
Path(URI iri)
Creates a Path object. |
|
| Method Summary | |
|---|---|
Path |
add(int position,
PathComponent component)
Adds a single component at a specified position within this path. |
Path |
add(int position,
String component)
Adds a single component at a specified position within this path. |
Path |
add(PathComponent component)
Adds a single component to the end of this path. |
Path |
add(String component)
Adds a single component to the end of this path. |
Path |
addAll(int position,
String[] components)
Adds the elements of a string array -- in order -- at a specified position within this path. |
Path |
addAll(String[] suffix)
Adds the elements of a string array -- in order -- to the end of this path. |
Object |
clone()
Generates a new copy of this path. |
int |
compareTo(Object obj)
Compares this path with another path for order. |
boolean |
endsWith(String[] suffix)
Determines whether this path ends with a specified suffix. |
boolean |
equals(Object that)
Indicates whether some other object is "equal to" this one. |
String |
get(int position)
Retrieves a component of this path. |
String |
getBase()
Returns the base of the path. |
Path |
getChild(PathComponent component)
Returns a child path |
Path |
getChild(String component)
Returns a child path |
PathComponent |
getComponent(int position)
Return the specified component |
Path |
getDescendant(String[] suffix)
Returns a descendant path. |
PathComponent |
getLastComponent()
Returns the last component of a path. |
Path |
getParent()
Returns the parent path. |
Path |
getPrefix(int position)
Creates a path whose components consist of a prefix of the components of this path. |
String[] |
getSuffix(int position)
Creates a suffix of the components in this path. |
String |
getUriReference(String fragmentIdentifier)
Generates an URI refercence for this Path and the given fragment identifier |
int |
hashCode()
Returns the hash code value for this path. |
boolean |
isEmpty()
Determines whether this path is empty. |
boolean |
isLike(Path pattern)
Determines whether the path corresponds to the pattern. |
void |
lock()
Make this path object unmodifiable |
String |
remove(int position)
Removes a component from this path. |
void |
setTo(Path source)
Set this path to the same value as another one. |
int |
size()
Returns the number of path components for this path. |
boolean |
startsWith(Path prefix)
Determines whether this path starts with a specified prefix. |
boolean |
startsWith(String[] prefix)
Determines whether this path starts with a specified prefix. |
URI |
toIRI()
Generates the XRI 2 based IRI representation of this path. |
static Path[] |
toPathArray(List source)
Store a list's values in a Path array. |
String |
toString()
Generates the string representation of this path. |
String |
toUri()
Generates the URI representation of this path. |
String |
toXri()
Generates the XRI 1 representation of this path. |
XRI |
toXRI()
Generates the XRI 2 representation of this path. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String URI_SCHEME
| Constructor Detail |
|---|
public Path(String[] components)
components - path components
RuntimeServiceException - in case of invalid components
NullPointerException - if components is nullpublic Path(String charSequence)
Path object.
path - The non-null string to parse.
RuntimeServiceException - in case of marshalling errorpublic Path(URI iri)
Path object.
iri - The non-null IRI.
RuntimeServiceException - in case of marshalling errorpublic Path(Path path)
Path object.
path - The new path will consist of this name's components| Method Detail |
|---|
public Path getParent()
ArrayIndexOutOfBoundsException - if the path is emptypublic Path getChild(String component)
component - the component to be added
RuntimeServiceException - if the component is null or emptypublic Path getChild(PathComponent component)
component - the component to be added
RuntimeServiceException - if the component is null or emptypublic Path getDescendant(String[] suffix)
suffix - the components to be added
RuntimeServiceException - if any of the components is null or emptypublic String getBase()
ArrayIndexOutOfBoundsException - if the path is emptypublic PathComponent getLastComponent()
ArrayIndexOutOfBoundsException - if the path is emptypublic PathComponent getComponent(int position)
position - the 0-based index of the component to
retrieve. Must be in the range [0,size()).
ArrayIndexOutOfBoundsException - if position is outside the specified rangepublic String toUri()
public String toXri()
The string representation thus generated can be passed to the Path constructor to create a new equivalent path.
public XRI toXRI()
The string representation of the generated XRI can be passed to the Path constructor to create a new equivalent path.
public URI toIRI()
public String getUriReference(String fragmentIdentifier)
fragmentIdentifier - The fragment identifier
public int compareTo(Object obj)
compareTo in interface Comparablethe - non-null object to compare against.
ClassCastException - if obj is not an instance of Pathpublic int size()
public boolean isEmpty()
public String get(int position)
position - the 0-based index of the component to
retrieve. Must be in the range [0,size()).
ArrayIndexOutOfBoundsException - if position is outside the specified rangepublic Path getPrefix(int position)
position - the 0-based index of the component at which
to stop. Must be in the range [0,size()].
ArrayIndexOutOfBoundsException - if position is outside the specified rangepublic String[] getSuffix(int position)
position - the 0-based index of the component at which
to start. Must be in the range [0,size()].
ArrayIndexOutOfBoundsException - if position is outside the specified rangepublic boolean startsWith(String[] prefix)
prefix - the path to check
public boolean startsWith(Path prefix)
components - the path to check
public boolean endsWith(String[] suffix)
suffix - the string array to check
public Path addAll(String[] suffix)
suffix - the components to add
RuntimeServiceException - if suffix is not a valid name, or if the
addition of the components would violate the
syntax rules of this path
public Path addAll(int position,
String[] components)
components - the components to addposition - the index in this path at which to add the
new components. Must be in the range
[0,size()].
ArrayIndexOutOfBoundsException - if position is outside the specified range
RuntimeServiceException - if components contains invalid path componentspublic Path add(String component)
component - the component to add
RuntimeServiceException - if adding component would violate the syntax
rules of this pathpublic Path add(PathComponent component)
component - the component to add
RuntimeServiceException - if the component is null or empty
public Path add(int position,
String component)
component - the component to addposition - the index at which to add the new
component. Must be in the range
[0,size()].
ArrayIndexOutOfBoundsException - if position is outside the specified range
RuntimeServiceException - if adding component would violate the syntax
rules of this path
public Path add(int position,
PathComponent component)
component - the component to addposition - the index at which to add the new component.
Must be in the range [0,size()].
ArrayIndexOutOfBoundsException - if position is outside the specified range
RuntimeServiceException - if the component is null or emptypublic String remove(int position)
position - the index of the component to remove.
Must be in the range [0,size()).
ArrayIndexOutOfBoundsException - if position is outside the specified range
RuntimeServiceException - if deleting the component would violate the
syntax rules of the pathpublic void setTo(Path source)
source - This path will have the same components as source.
ArrayIndexOutOfBoundsException - if position is outside the specified range
RuntimeServiceException - if deleting the component would violate the
syntax rules of the pathpublic void lock()
public boolean isLike(Path pattern)
public Object clone()
clone in class Objectpublic String toString()
toString in class Objectpublic boolean equals(Object that)
equals in class Objectobject - - the reference object with which to compare.
public int hashCode()
This ensures that path1.equals(path2) implies that path1.hashCode()==path2.hashCode() for any two paths, path1 and path2, as required by the general contract of Object.hashCode.
hashCode in class Objectpublic static Path[] toPathArray(List source)
ClassCastException - If any of the values is not an instance of Path
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||