Class SimpleName

    • Field Detail

      • name

        protected final Name name
        The JNDI name wrapped by this SimpleName. While JNDI names are mutable, GenericName are expected to be immutable. Consequently users are advised to not modify this object.
        See Also:
        jndiName()
    • Constructor Detail

      • SimpleName

        protected SimpleName​(SimpleNameSpace scope,
                             Name name)
        Creates a new instance backed by the given JNDI name. This constructor does not clone the given JNDI name. While this implementation is robust to change in the wrapped object, it is a better practice to keep the JNDI name unmodified after SimpleName construction.
        Parameters:
        scope - the scope (name space) in which the given name is local, or null.
        name - the JNDI name wrapped by this SimpleName (not cloned).
    • Method Detail

      • jndiName

        public Name jndiName()
        Returns a clone of the JNDI name wrapped by this object.
        Returns:
        a clone of name.
      • scope

        public NameSpace scope()
        Returns the scope (name space) in which this name is local. The scope of a name determines where a name starts. The scope is set on creation and is not modifiable.
        Specified by:
        scope in interface GenericName
      • depth

        public int depth()
        Returns the number of levels specified by this name. The default implementation returns the size of the wrapped JNDI name.
        Specified by:
        depth in interface GenericName
        See Also:
        Name.size()
      • toFullyQualifiedName

        public GenericName toFullyQualifiedName()
        Returns a view of this name as a fully-qualified name. The scope of a fully qualified name will be global. If the scope of this name is already global, then this method returns this.
        Specified by:
        toFullyQualifiedName in interface GenericName
        Returns:
        the fully-qualified name (never null).
      • push

        public ScopedName push​(GenericName scope)
        Returns this name expanded with the specified scope. One may represent this operation as a concatenation of the specified scope with this.
        Specified by:
        push in interface GenericName
        Parameters:
        scope - The name to use as prefix.
        Returns:
        a concatenation of the given name with this name.
        See Also:
        Name.addAll(Name)
      • toString

        public String toString()
        Returns a string representation of this generic name. Note that the scope is not part of this string representation.
        Specified by:
        toString in interface GenericName
        Overrides:
        toString in class Object
        Returns:
        a string representation of this name.
      • toInternationalString

        public InternationalString toInternationalString()
        Returns a local-dependent string representation of this generic name. The default implementation wraps the toString() value.
        Specified by:
        toInternationalString in interface GenericName
        Returns:
        a localizable string representation of this name.
      • compareTo

        public int compareTo​(GenericName other)
        Compares this name with the given object for lexicographical order. Note that the scope is not part of this comparison.
        Specified by:
        compareTo in interface Comparable<GenericName>
        Specified by:
        compareTo in interface GenericName
        Parameters:
        other - the other object to compare to this name.
      • equals

        public boolean equals​(Object other)
        Compares the given object to this name for equality. This method compares both the scope and the name given to the constructor.
        Overrides:
        equals in class Object
        Parameters:
        other - the other object to compare to this name.
      • hashCode

        public int hashCode()
        Returns a hash code value for this name.
        Overrides:
        hashCode in class Object