org.jboss.dna.graph.property.basic
Class BasicName

java.lang.Object
  extended by org.jboss.dna.graph.property.basic.BasicName
All Implemented Interfaces:
Serializable, Comparable<Name>, Name

@Immutable
public class BasicName
extends Object
implements Name

A basic implementation of Name.

Author:
Randall Hauch, John Verhaeg
See Also:
Serialized Form

Constructor Summary
BasicName(String namespaceUri, String localName)
           
 
Method Summary
 int compareTo(Name that)
          
 boolean equals(Object obj)
          
 String getLocalName()
          Get the local name part of this qualified name.
 String getNamespaceUri()
          Get the URI for the namespace used in this qualified name.
 String getString()
          Get the string form of the name.
 String getString(NamespaceRegistry namespaceRegistry)
          Get the string form of the name, using the supplied namespace registry to convert the namespace URI to a prefix.
 String getString(NamespaceRegistry namespaceRegistry, TextEncoder encoder)
          Get the encoded string form of the name, using the supplied namespace registry to convert the namespace URI to a prefix.
 String getString(NamespaceRegistry namespaceRegistry, TextEncoder encoder, TextEncoder delimiterEncoder)
          Get the encoded string form of the name, using the supplied namespace registry to convert the names' namespace URIs to prefixes and the supplied encoder to encode characters in each of the path segments, and using the second delimiter to encode (or convert) the delimiter used between the namespace prefix and the local part.
 String getString(TextEncoder encoder)
          Get the encoded string form of the name, using the supplied encoder to encode characters in the local name and namespace.
 int hashCode()
          
 String toString()
          
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicName

public BasicName(String namespaceUri,
                 String localName)
Method Detail

getLocalName

public String getLocalName()
Get the local name part of this qualified name.

Specified by:
getLocalName in interface Name
Returns:
the local name; never null

getNamespaceUri

public String getNamespaceUri()
Get the URI for the namespace used in this qualified name.

Specified by:
getNamespaceUri in interface Name
Returns:
the URI; never null but possibly empty

getString

public String getString()
Get the string form of the name. The default encoder is used to encode characters in the local name and namespace.

Specified by:
getString in interface Name
Returns:
the encoded string
See Also:
Name.getString(TextEncoder)

getString

public String getString(TextEncoder encoder)
Get the encoded string form of the name, using the supplied encoder to encode characters in the local name and namespace.

Specified by:
getString in interface Name
Parameters:
encoder - the encoder to use, or null if the default encoder should be used
Returns:
the encoded string
See Also:
Name.getString()

getString

public String getString(NamespaceRegistry namespaceRegistry)
Get the string form of the name, using the supplied namespace registry to convert the namespace URI to a prefix. The default encoder is used to encode characters in each of the path segments.

Specified by:
getString in interface Name
Parameters:
namespaceRegistry - the namespace registry that should be used to obtain the prefix for the namespace URI
Returns:
the encoded string
See Also:
Name.getString(NamespaceRegistry,TextEncoder)

getString

public String getString(NamespaceRegistry namespaceRegistry,
                        TextEncoder encoder)
Get the encoded string form of the name, using the supplied namespace registry to convert the namespace URI to a prefix.

Specified by:
getString in interface Name
Parameters:
namespaceRegistry - the namespace registry that should be used to obtain the prefix for the namespace URI
encoder - the encoder to use, or null if the default encoder should be used
Returns:
the encoded string
See Also:
Name.getString(NamespaceRegistry)

getString

public String getString(NamespaceRegistry namespaceRegistry,
                        TextEncoder encoder,
                        TextEncoder delimiterEncoder)
Get the encoded string form of the name, using the supplied namespace registry to convert the names' namespace URIs to prefixes and the supplied encoder to encode characters in each of the path segments, and using the second delimiter to encode (or convert) the delimiter used between the namespace prefix and the local part.

Specified by:
getString in interface Name
Parameters:
namespaceRegistry - the namespace registry that should be used to obtain the prefix for the namespace URIs in the segment names
encoder - the encoder to use for encoding the local part and namespace prefix, or null if the default encoder should be used
delimiterEncoder - the encoder to use for encoding the delimiter between the local part and namespace prefix, or null if the standard delimiter should be used
Returns:
the encoded string
See Also:
Name.getString(org.jboss.dna.graph.property.NamespaceRegistry, org.jboss.dna.common.text.TextEncoder, org.jboss.dna.common.text.TextEncoder)

compareTo

public int compareTo(Name that)

Specified by:
compareTo in interface Comparable<Name>

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

toString

public String toString()

Overrides:
toString in class Object


Copyright © 2008-Present JBoss a division of Red Hat. All Rights Reserved.