public final class QID extends java.lang.Object implements java.lang.Iterable<java.lang.String>, java.io.Serializable, java.lang.Comparable<QID>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SEPARATOR
The separator string.
|
Modifier and Type | Method and Description |
---|---|
QID |
appendFirst(java.lang.String segment)
Appends a segment to the start of this qualified identifier.
|
QID |
appendLast(java.lang.String segment)
Appends a segment to the end of this qualified identifier.
|
int |
compareTo(QID other) |
static QID |
create(java.util.Collection<java.lang.String> segments)
Creates a qualified identifier from the given segments.
|
static QID |
create(java.lang.String... segments)
Creates a qualified identifier from the given segments.
|
static QID |
create(java.lang.String id)
Creates a qualified identifier with the given identifier, the module name
is not set.
|
static QID |
create(java.lang.String module,
java.lang.String id)
Creates a qualified identifier with the given module name and the
identifier.
|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
get(int index)
Returns the i-th segment of this qualified identifier.
|
java.lang.String |
getFullName()
Returns the full name of this qualified identifier (encoded segments
separated with
SEPARATOR . |
static java.lang.String |
getFullName(java.lang.String... segments)
Returns a full name of a qualified identifier from the given segments.
|
java.lang.String |
getId()
Returns the id (the last segment).
|
java.lang.String |
getModule()
Returns the module name (the first segment if there are at least two
segments).
|
java.util.List<java.lang.String> |
getSegments()
Returns an unmodifiable list of the segments of this qualified
identifier.
|
int |
hashCode() |
boolean |
isSimple()
Returns true if the identifier contains only one segment.
|
java.util.Iterator<java.lang.String> |
iterator() |
static QID |
parse(java.lang.String source)
Parses a qualified identifier from a string.
|
static QID |
parse(org.antlr.runtime.tree.Tree tree)
Parses a qualified identifier from the given ANTLR tree.
|
QID |
removeFirst()
Removes the first segment of this qualified identifier.
|
QID |
removeLast()
Removes the last segment of this qualified identifier.
|
QID |
replaceFirst(java.lang.String segment)
Replaces the first segment of this qualified identifier.
|
QID |
replaceLast(java.lang.String segment)
Replaces the last segment of this qualified identifier.
|
int |
size()
Returns the size of this qualified identifier.
|
java.lang.String |
toString()
Returns the full name of this qualified identifier.
|
public static final java.lang.String SEPARATOR
public static QID create(java.lang.String id)
id
- java.lang.IllegalArgumentException
- if the id
is nullpublic static QID create(java.lang.String module, java.lang.String id)
module
- id
- java.lang.IllegalArgumentException
- if the module
or the id
is nullpublic static QID create(java.lang.String... segments)
segments
- java.lang.IllegalArgumentException
- if any of the segments
is null or if the
segments
contain 0 elementspublic static QID create(java.util.Collection<java.lang.String> segments)
segments
- java.lang.IllegalArgumentException
- if any of the segments
is null or if the
segments
contain 0 elementspublic static java.lang.String getFullName(java.lang.String... segments)
segments
- public static QID parse(java.lang.String source) throws ValidationException
source
- ValidationException
- if the string
is not a valid qualified identifierjava.lang.NullPointerException
- if the string
is nullpublic static QID parse(org.antlr.runtime.tree.Tree tree)
tree
- java.lang.NullPointerException
- if the tree
is nullpublic java.lang.String getModule()
public java.lang.String getId()
public java.lang.String getFullName()
SEPARATOR
.public boolean isSimple()
public int size()
public java.lang.String get(int index)
index
- java.lang.ArrayIndexOutOfBoundsException
- if the index
is out of boundspublic java.util.List<java.lang.String> getSegments()
public java.util.Iterator<java.lang.String> iterator()
iterator
in interface java.lang.Iterable<java.lang.String>
public QID appendFirst(java.lang.String segment)
segment
- java.lang.NullPointerException
- ifpublic QID appendLast(java.lang.String segment)
segment
- public QID replaceFirst(java.lang.String segment)
segment
- public QID replaceLast(java.lang.String segment)
segment
- public QID removeFirst()
public QID removeLast()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.