com.caucho.naming
Class QName

java.lang.Object
  extended by com.caucho.naming.QName
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<java.lang.Object>, javax.naming.Name

public class QName
extends java.lang.Object
implements javax.naming.Name

Represents a parsed JNDI name.

See Also:
Serialized Form

Field Summary
protected  javax.naming.Context _context
           
 
Fields inherited from interface javax.naming.Name
serialVersionUID
 
Constructor Summary
QName(javax.naming.Context context)
          Creates a root name based on a context.
QName(javax.naming.Context context, java.lang.String first)
          Creates a new name with a single component.
QName(javax.naming.Context context, java.lang.String first, java.lang.String rest)
          Creates a new name with two components
 
Method Summary
 javax.naming.Name add(int posn, java.lang.String comp)
          Add a component at a specific position, returning the name.
 javax.naming.Name add(java.lang.String comp)
          Add a component to the tail of the name, returning the name.
 javax.naming.Name addAll(int posn, javax.naming.Name suffix)
          Insert a name to the current name.
 javax.naming.Name addAll(javax.naming.Name suffix)
          Append a name to the current name.
 java.lang.Object clone()
          Clones the name.
 int compareTo(java.lang.Object rawB)
          Compares the name to another name.
 boolean endsWith(javax.naming.Name name)
           
 boolean equals(java.lang.Object obj)
          Returns true if the object is an equivalent name.
 java.lang.String get(int pos)
           
 java.util.Enumeration getAll()
           
 javax.naming.Name getPrefix(int posn)
           
 javax.naming.Name getSuffix(int posn)
           
 int hashCode()
          Returns the name's hash code.
 boolean isEmpty()
           
 java.lang.Object remove(int posn)
           
 int size()
           
 boolean startsWith(javax.naming.Name name)
          Returns true if the argument is a prefix of the name.
 java.lang.String toString()
          Converts the name to a string.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_context

protected javax.naming.Context _context
Constructor Detail

QName

public QName(javax.naming.Context context)
Creates a root name based on a context.

Parameters:
context - the root context

QName

public QName(javax.naming.Context context,
             java.lang.String first)
Creates a new name with a single component.

Parameters:
context - the root context
first - the first name component

QName

public QName(javax.naming.Context context,
             java.lang.String first,
             java.lang.String rest)
Creates a new name with two components

Parameters:
context - the root context
first - the first name component
tail - the tail name component
Method Detail

clone

public java.lang.Object clone()
Clones the name.

Specified by:
clone in interface javax.naming.Name
Overrides:
clone in class java.lang.Object

size

public int size()
Specified by:
size in interface javax.naming.Name

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface javax.naming.Name

getAll

public java.util.Enumeration getAll()
Specified by:
getAll in interface javax.naming.Name

get

public java.lang.String get(int pos)
Specified by:
get in interface javax.naming.Name

getPrefix

public javax.naming.Name getPrefix(int posn)
Specified by:
getPrefix in interface javax.naming.Name

getSuffix

public javax.naming.Name getSuffix(int posn)
Specified by:
getSuffix in interface javax.naming.Name

startsWith

public boolean startsWith(javax.naming.Name name)
Returns true if the argument is a prefix of the name.

Specified by:
startsWith in interface javax.naming.Name
Parameters:
name - the Name to start as a prefix.

endsWith

public boolean endsWith(javax.naming.Name name)
Specified by:
endsWith in interface javax.naming.Name

addAll

public javax.naming.Name addAll(javax.naming.Name suffix)
                         throws javax.naming.InvalidNameException
Append a name to the current name.

Specified by:
addAll in interface javax.naming.Name
Parameters:
suffix - the name to add as a suffix
Returns:
the modified name
Throws:
javax.naming.InvalidNameException

addAll

public javax.naming.Name addAll(int posn,
                                javax.naming.Name suffix)
                         throws javax.naming.InvalidNameException
Insert a name to the current name.

Specified by:
addAll in interface javax.naming.Name
Parameters:
suffix - the name to add as a suffix
Returns:
the modified name
Throws:
javax.naming.InvalidNameException

add

public javax.naming.Name add(java.lang.String comp)
                      throws javax.naming.InvalidNameException
Add a component to the tail of the name, returning the name.

Specified by:
add in interface javax.naming.Name
Parameters:
comp - the new component to add.
Returns:
the modified name
Throws:
javax.naming.InvalidNameException

add

public javax.naming.Name add(int posn,
                             java.lang.String comp)
                      throws javax.naming.InvalidNameException
Add a component at a specific position, returning the name.

Specified by:
add in interface javax.naming.Name
Returns:
the modified name
Throws:
javax.naming.InvalidNameException

remove

public java.lang.Object remove(int posn)
                        throws javax.naming.InvalidNameException
Specified by:
remove in interface javax.naming.Name
Throws:
javax.naming.InvalidNameException

hashCode

public int hashCode()
Returns the name's hash code.

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Returns true if the object is an equivalent name.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to test for equality.

compareTo

public int compareTo(java.lang.Object rawB)
Compares the name to another name.

Specified by:
compareTo in interface java.lang.Comparable<java.lang.Object>
Specified by:
compareTo in interface javax.naming.Name
Returns:
-1 if less than b, 0 if equal, or 1 if greater chan

toString

public java.lang.String toString()
Converts the name to a string.

Overrides:
toString in class java.lang.Object