|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.dna.graph.Location
@Immutable public abstract class Location
The location of a node, as specified by either its path, UUID, and/or identification properties.
Constructor Summary | |
---|---|
Location()
|
Method Summary | |
---|---|
int |
compareTo(Location that)
|
static Location |
create(Iterable<Property> idProperties)
Create a location defined by a path and an iterator over identification properties. |
static Location |
create(List<Property> idProperties)
Create a location defined by multiple identification properties. |
static Location |
create(Path path)
Create a location defined by a path. |
static Location |
create(Path path,
Iterable<Property> idProperties)
Create a location defined by a path and an iterator over identification properties. |
static Location |
create(Path path,
Property idProperty)
Create a location defined by a path and a single identification property. |
static Location |
create(Path path,
Property firstIdProperty,
Property... remainingIdProperties)
Create a location defined by a path and multiple identification properties. |
static Location |
create(Path path,
UUID uuid)
Create a location defined by a path and an UUID. |
static Location |
create(Property idProperty)
Create a location defined by a single identification property. |
static Location |
create(Property firstIdProperty,
Property... remainingIdProperties)
Create a location defined by multiple identification properties. |
static Location |
create(UUID uuid)
Create a location defined by a UUID. |
boolean |
equals(Object obj)
|
abstract List<Property> |
getIdProperties()
Get the identification properties that (at least in part) define this location. |
Property |
getIdProperty(Name name)
Get the identification property with the supplied name, if there is such a property. |
abstract Path |
getPath()
Get the path that (at least in part) defines this location. |
String |
getString()
Get the string form of the location. |
String |
getString(NamespaceRegistry namespaceRegistry)
Get the encoded string form of the location, using the supplied encoder to encode characters in each of the location's path and properties. |
String |
getString(NamespaceRegistry namespaceRegistry,
TextEncoder encoder)
Get the encoded string form of the location, using the supplied encoder to encode characters in each of the location's path and properties. |
String |
getString(NamespaceRegistry namespaceRegistry,
TextEncoder encoder,
TextEncoder delimiterEncoder)
Get the encoded string form of the location, using the supplied encoder to encode characters in each of the location's path and properties. |
String |
getString(TextEncoder encoder)
Get the encoded string form of the location, using the supplied encoder to encode characters in each of the location's path and properties. |
UUID |
getUuid()
Get the first UUID that is in one of the identification properties . |
int |
hashCode()
|
boolean |
hasIdProperties()
Return whether this location is defined (at least in part) with identification properties. |
boolean |
hasPath()
Return whether this location is defined (at least in part) by a path. |
boolean |
isSame(Location other)
Compare this location to the supplied location, and determine whether the two locations represent the same logical location. |
boolean |
isSame(Location other,
boolean requireSameNameSiblingIndexes)
Compare this location to the supplied location, and determine whether the two locations represent the same logical location. |
Iterator<Property> |
iterator()
|
String |
toString()
|
abstract Location |
with(Path newPath)
Create a copy of this location that uses the supplied path. |
abstract Location |
with(Property newIdProperty)
Create a copy of this location that adds the supplied identification property. |
abstract Location |
with(UUID uuid)
Create a copy of this location that adds the supplied UUID as an identification property. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Location()
Method Detail |
---|
public static Location create(Path path)
path
- the path
Location
with the given path and no identification properties
IllegalArgumentException
- if path
is nullpublic static Location create(UUID uuid)
uuid
- the UUID
Location
with no path and a single identification property with the name DnaLexicon.UUID
and the given uuid
for a value.
IllegalArgumentException
- if uuid
is nullpublic static Location create(Path path, UUID uuid)
path
- the pathuuid
- the UUID, or null if there is no UUID
Location
with the given path (if any) and a single identification property with the name
DnaLexicon.UUID
and the given uuid
(if it is present) for a value.
IllegalArgumentException
- if path
is nullpublic static Location create(Path path, Property idProperty)
path
- the pathidProperty
- the identification property
Location
with the given path and identification property (if it is present).
IllegalArgumentException
- if path
or idProperty
is nullpublic static Location create(Path path, Property firstIdProperty, Property... remainingIdProperties)
path
- the pathfirstIdProperty
- the first identification propertyremainingIdProperties
- the remaining identification property
Location
with the given path and identification properties.
IllegalArgumentException
- if any of the arguments are nullpublic static Location create(Path path, Iterable<Property> idProperties)
path
- the pathidProperties
- the iterator over the identification properties
Location
with the given path and identification properties
IllegalArgumentException
- if any of the arguments are nullpublic static Location create(Property idProperty)
idProperty
- the identification property
Location
with no path and the given identification property.
IllegalArgumentException
- if idProperty
is nullpublic static Location create(Property firstIdProperty, Property... remainingIdProperties)
firstIdProperty
- the first identification propertyremainingIdProperties
- the remaining identification property
Location
with no path and the given and identification properties.
IllegalArgumentException
- if any of the arguments are nullpublic static Location create(Iterable<Property> idProperties)
idProperties
- the iterator over the identification properties
Location
with no path and the given identification properties.
IllegalArgumentException
- if any of the arguments are nullpublic static Location create(List<Property> idProperties)
idProperties
- the identification properties
Location
with no path and the given identification properties.
IllegalArgumentException
- if idProperties
is null or emptypublic abstract Path getPath()
public boolean hasPath()
path
helps define this locationpublic abstract List<Property> getIdProperties()
public boolean hasIdProperties()
identification properties
help define this locationpublic Property getIdProperty(Name name)
name
- the name of the identification property
are no identification properties
public UUID getUuid()
identification properties
.
public boolean isSame(Location other)
/x/y
" path/x/y/z
"/x/y/z
" path and an identification property {id=3}Note that passing a null location as a parameter will always return false.
other
- the other location to compare
public boolean isSame(Location other, boolean requireSameNameSiblingIndexes)
/x/y
" path/x/y/z
"/x/y/z
" path and an identification property {id=3}Note that passing a null location as a parameter will always return false.
other
- the other location to comparerequireSameNameSiblingIndexes
- true if the paths must have equivalent same-name-sibling indexes
, or false if the same-name-siblings may be different
public Iterator<Property> iterator()
iterator
in interface Iterable<Property>
Iterable.iterator()
public int hashCode()
hashCode
in class Object
Object.hashCode()
public boolean equals(Object obj)
equals
in class Object
Object.equals(java.lang.Object)
public int compareTo(Location that)
compareTo
in interface Comparable<Location>
Comparable.compareTo(java.lang.Object)
public String getString()
getString(TextEncoder)
,
getString(NamespaceRegistry)
,
getString(NamespaceRegistry, TextEncoder)
,
getString(NamespaceRegistry, TextEncoder, TextEncoder)
public String getString(TextEncoder encoder)
encoder
- the encoder to use, or null if the default encoder should be used
getString()
,
getString(NamespaceRegistry)
,
getString(NamespaceRegistry, TextEncoder)
,
getString(NamespaceRegistry, TextEncoder, TextEncoder)
public String getString(NamespaceRegistry namespaceRegistry)
namespaceRegistry
- the namespace registry to use for getting the string form of the path and properties, or null if
no namespace registry should be used
getString()
,
getString(TextEncoder)
,
getString(NamespaceRegistry, TextEncoder)
,
getString(NamespaceRegistry, TextEncoder, TextEncoder)
public String getString(NamespaceRegistry namespaceRegistry, TextEncoder encoder)
namespaceRegistry
- the namespace registry to use for getting the string form of the path and properties, or null if
no namespace registry should be usedencoder
- the encoder to use, or null if the default encoder should be used
getString()
,
getString(TextEncoder)
,
getString(NamespaceRegistry)
,
getString(NamespaceRegistry, TextEncoder, TextEncoder)
public String getString(NamespaceRegistry namespaceRegistry, TextEncoder encoder, TextEncoder delimiterEncoder)
namespaceRegistry
- the namespace registry to use for getting the string form of the path and properties, or null if
no namespace registry should be usedencoder
- the encoder to use, or null if the default encoder should be useddelimiterEncoder
- the encoder to use for encoding the delimiters in paths, names, and properties, or null if the
standard delimiters should be used
getString()
,
getString(TextEncoder)
,
getString(NamespaceRegistry)
,
getString(NamespaceRegistry, TextEncoder)
public String toString()
toString
in class Object
Object.toString()
public abstract Location with(Property newIdProperty)
newIdProperty
- the new identification property, which may be null
public abstract Location with(Path newPath)
newPath
- the new path for the location
public abstract Location with(UUID uuid)
uuid
- the new UUID, which may be null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |