org.jboss.cache
Class StringFqn

java.lang.Object
  extended by org.jboss.cache.Fqn
      extended by org.jboss.cache.StringFqn
All Implemented Interfaces:
Externalizable, Serializable, Cloneable, Comparable

public final 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

Field Summary
 
Fields inherited from class org.jboss.cache.Fqn
elements, ROOT, SEPARATOR, size, stringRepresentation
 
Constructor Summary
  StringFqn()
           
protected StringFqn(List<String> stringElements)
           
protected StringFqn(String stringRep)
           
protected StringFqn(StringFqn base, List<String> elements)
           
protected StringFqn(StringFqn base, StringFqn relative)
           
 
Method Summary
protected  int calculateHashCode()
          Calculates a hash code by summing the hash code of all elements.
 boolean equals(Object other)
          Returns true if obj is a Fqn with the same elements.
 String getStringRepresentation()
           
 boolean isChildOrEquals(Fqn parentFqn)
          Returns true if this Fqn is equals or the child of parentFqn.
 
Methods inherited from class org.jboss.cache.Fqn
clone, compareTo, fromElements, fromExternalStream, fromList, fromList, fromRelativeElements, fromRelativeFqn, fromRelativeList, fromString, get, getAncestor, getLastElement, getLastElementAsString, getParent, getStringRepresentation, getSubFqn, hasElement, hashCode, isChildOf, isDirectChildOf, isRoot, peekElements, readExternal, root, size, toString, writeExternal
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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)
Method Detail

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 © 2009 JBoss, a division of Red Hat. All Rights Reserved.