org.apache.jackrabbit.name
Class Name

java.lang.Object
  extended byorg.apache.jackrabbit.name.Name

public final class Name
extends Object

Qualified name. Instance of this immutable class are used to represent qualified names. A qualified name consists of a namespace URI and a local part.


Constructor Summary
Name(String namespace, String name)
          Creates a qualified name instance.
 
Method Summary
 boolean equals(Object object)
          Compares for equality.
static Name fromJCRName(Session session, String name)
          Parses the given prefixed JCR name into a qualified name instance.
 String getLocalPart()
          Returns the local part of the qualified name.
 String getNamespaceURI()
          Returns the namespace URI of the qualified name.
 int hashCode()
          Calculates the hash code of the qualified name.
 String toJCRName(Session session)
          Returns the prefixed JCR name representation of the qualified name.
 String toString()
          Returns a string representation of the qualified name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Name

public Name(String namespace,
            String name)
Creates a qualified name instance.

Parameters:
namespace - namespace URI
name - local part
Method Detail

getNamespaceURI

public String getNamespaceURI()
Returns the namespace URI of the qualified name.

Returns:
namespace URI

getLocalPart

public String getLocalPart()
Returns the local part of the qualified name.

Returns:
local part

equals

public boolean equals(Object object)
Compares for equality. Two qualified names are equal if they have the same namespace URI and the same local part.

Parameters:
object - the object to compare to
Returns:
true if the given object is equal to this one, false otherwise
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Calculates the hash code of the qualified name.

Returns:
hash code
See Also:
Object.hashCode()

toString

public String toString()
Returns a string representation of the qualified name.

Returns:
string representation
See Also:
Object.toString()

fromJCRName

public static Name fromJCRName(Session session,
                               String name)
                        throws NamespaceException,
                               RepositoryException
Parses the given prefixed JCR name into a qualified name instance. The namespace prefix is resolved using the current session.

Parameters:
session - current session
name - prefixed JCR name
Returns:
qualified name
Throws:
NamespaceException - if the namespace prefix is not registered
RepositoryException - if another error occurs

toJCRName

public String toJCRName(Session session)
                 throws NamespaceException,
                        RepositoryException
Returns the prefixed JCR name representation of the qualified name. The namespace prefix is retrieved from the current session.

Parameters:
session - current session
Returns:
prefixed JCR name
Throws:
NamespaceException - if the namespace URI is not registered
RepositoryException - if another error occurs


Copyright © 2004-2005 . All Rights Reserved.