|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.cache.Fqn
public class Fqn
Fully qualified name. A list of relatives names, which can be any Object, from root to a given node. This class is immutable.
Note thatFqn f = new Fqn("/a/b/c");
is not the same as
Fqn f = Fqn.fromString("/a/b/c");
The former will result in a single Fqn, called "/a/b/c" which hangs directly under Fqn.ROOT.
The latter will result in 3 Fqns, called "a", "b" and "c", where "c" is a child of "b", "b" is a child of "a", and "a" hangs off Fqn.ROOT.
Another way to look at it is that the "/" separarator is only parsed when it form sa part of a String passed in to Fqn.fromString() and not otherwise.
Field Summary | |
---|---|
static Fqn |
ROOT
Immutable root FQN. |
static java.lang.String |
SEPARATOR
Separator between FQN elements. |
Constructor Summary | |
---|---|
Fqn()
Constructs a root FQN. |
|
Fqn(Fqn base,
Fqn relative)
Constructs a FQN from a base and relative FQN. |
|
Fqn(Fqn base,
java.util.List relative)
Constructs a FQN from a base and a list of relative names. |
|
Fqn(Fqn base,
java.lang.Object relative_name)
Constructs a FQN from a base and relative name. |
|
Fqn(Fqn base,
java.lang.Object relative_name1,
java.lang.Object relative_name2)
Constructs a FQN from a base and two relative names. |
|
Fqn(Fqn base,
java.lang.Object relative_name1,
java.lang.Object relative_name2,
java.lang.Object relative_name3)
Constructs a FQN from a base and three relative names. |
|
Fqn(java.util.List names)
Constructs a FQN from a list of names. |
|
Fqn(java.lang.Object name)
Constructs a single element Fqn. |
|
Fqn(java.lang.Object[] names)
Constructs a FQN from an array of names. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Clones the FQN. |
boolean |
equals(java.lang.Object obj)
Returns true if obj is a FQN with the same elements. |
static Fqn |
fromString(java.lang.String fqn)
Returns a new FQN from a string, where the elements are deliminated by one or more separator ( SEPARATOR ) characters.Example use: |
java.lang.Object |
get(int index)
Returns the Nth element in the FQN. |
Fqn |
getFqnChild(int index)
Obtains a child Fqn from a sub-index. |
Fqn |
getFqnChild(int startIndex,
int endIndex)
Obtains a child Fqn from a sub-index. |
java.lang.Object |
getLast()
Returns the last element in the FQN. |
java.lang.String |
getName()
Returns a String representation of the last element that makes up this Fqn. |
Fqn |
getParent()
Returns the parent of this FQN. |
boolean |
hasElement(java.lang.Object o)
Returns true if the FQN contains this element. |
int |
hashCode()
Returns a hash code with FQN elements. |
boolean |
isChildOf(Fqn parentFqn)
Returns true if this fqn is child of parentFqn |
boolean |
isChildOrEquals(Fqn parentFqn)
Returns true if this fqn is equals or the child of parentFqn. |
boolean |
isRoot()
Returns true if this is a root FQN. |
java.util.List |
peekElements()
Peeks into the elements that build up this Fqn. |
void |
readExternal(java.io.ObjectInput in)
|
int |
size()
Returns the number of elements in the FQN. |
java.lang.String |
toString()
Returns this FQN as a string, prefixing the first element with a / and joining each subsequent element with a /. |
void |
writeExternal(java.io.ObjectOutput out)
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SEPARATOR
public static final Fqn ROOT
Constructor Detail |
---|
public Fqn()
public Fqn(java.lang.Object name)
SEPARATOR
are not parsed.
If you wish these to be parsed, use fromString(String)
.
fromString(String)
public Fqn(java.util.List names)
public Fqn(java.lang.Object[] names)
public Fqn(Fqn base, java.lang.Object relative_name)
public Fqn(Fqn base, Fqn relative)
public Fqn(Fqn base, java.util.List relative)
public Fqn(Fqn base, java.lang.Object relative_name1, java.lang.Object relative_name2)
public Fqn(Fqn base, java.lang.Object relative_name1, java.lang.Object relative_name2, java.lang.Object relative_name3)
Method Detail |
---|
public static Fqn fromString(java.lang.String fqn)
SEPARATOR
) characters.Fqn.fromString("/a//b/c/");
new Fqn(new Object[] { "a", "b", "c" });
new Fqn("/a/b/c");
Fqn(Object[])
,
Fqn(Object)
public Fqn getFqnChild(int index)
index
- where is the last index of child fqn
public Fqn getFqnChild(int startIndex, int endIndex)
public int size()
public java.lang.Object get(int index)
public java.lang.Object getLast()
getName()
public boolean hasElement(java.lang.Object o)
public java.lang.Object clone()
clone
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
SEPARATOR
.
Example:
new Fqn(new Object[] { "a", "b", "c" }).toString(); // "/a/b/c" Fqn.ROOT.toString(); // "/"
toString
in class java.lang.Object
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
public boolean isChildOf(Fqn parentFqn)
parentFqn
-
public boolean isChildOrEquals(Fqn parentFqn)
public Fqn getParent()
public boolean isRoot()
public java.lang.String getName()
SEPARATOR
.
public java.util.List peekElements()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |