org.jboss.cache
Class StringFqn
java.lang.Object
org.jboss.cache.Fqn
org.jboss.cache.StringFqn
- All Implemented Interfaces:
- Externalizable, Serializable, Cloneable, Comparable
public class StringFqn
- extends Fqn
An optimisation of Fqn that does more efficient equals() and hashcode() computations. This is returned by default when
the factory method Fqn.fromString(String)
is used, or when any of the other factory methods on Fqn
are
passed only String elements.
Note that the "/" character is illegal in any Fqn String element and if encountered may be used to split Fqn elements.
Expect indeterminate behaviour until proper String escaping is in place.
- Since:
- 2.2.0
- Author:
- Manik Surtani (manik@jboss.org)
- See Also:
- Serialized Form
Methods inherited from class org.jboss.cache.Fqn |
clone, compareTo, fromElements, fromExternalStream, fromList, fromRelativeElements, fromRelativeFqn, fromRelativeList, fromString, get, getAncestor, getLastElement, getLastElementAsString, getParent, getStringRepresentation, getSubFqn, hasElement, hashCode, isChildOf, isRoot, peekElements, readExternal, root, size, toString, writeExternal |
StringFqn
public StringFqn()
StringFqn
protected StringFqn(StringFqn base,
List<String> elements)
StringFqn
protected StringFqn(StringFqn base,
StringFqn relative)
StringFqn
protected StringFqn(List<String> stringElements)
StringFqn
protected StringFqn(String stringRep)
equals
public boolean equals(Object other)
- Description copied from class:
Fqn
- Returns true if obj is a Fqn with the same elements.
- Overrides:
equals
in class Fqn
calculateHashCode
protected int calculateHashCode()
- Description copied from class:
Fqn
- Calculates a hash code by summing the hash code of all elements.
- Overrides:
calculateHashCode
in class Fqn
- Returns:
- a cached hashcode
isChildOrEquals
public boolean isChildOrEquals(Fqn parentFqn)
- Description copied from class:
Fqn
- Returns true if this Fqn is equals or the child of parentFqn.
Example usage:
Fqn f1 = Fqn.fromString("/a/b");
Fqn f2 = Fqn.fromString("/a/b/c");
assertTrue(f1.isChildOrEquals(f2));
assertTrue(f1.isChildOrEquals(f1));
assertFalse(f2.isChildOrEquals(f1));
- Overrides:
isChildOrEquals
in class Fqn
- Parameters:
parentFqn
- candidate parent to test against
- Returns:
- true if this Fqn is equals or the child of parentFqn.
getStringRepresentation
public String getStringRepresentation()
Copyright © 2008 JBoss, a division of Red Hat. All Rights Reserved.