Class NameAwareAttribute

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.lang.Object>, javax.naming.directory.Attribute

    public final class NameAwareAttribute
    extends java.lang.Object
    implements javax.naming.directory.Attribute, java.lang.Iterable<java.lang.Object>
    Used internally to make DirContextAdapter properly handle Names as values.
    Since:
    2.0
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from interface javax.naming.directory.Attribute

        serialVersionUID
    • Constructor Summary

      Constructors 
      Constructor Description
      NameAwareAttribute​(java.lang.String id)
      Construct a new instance with the specified id and no values.
      NameAwareAttribute​(java.lang.String id, boolean orderMatters)
      Construct a new instance with the specified id, no values and order significance as specified.
      NameAwareAttribute​(java.lang.String id, java.lang.Object value)
      Construct a new instance with the specified id and one value.
      NameAwareAttribute​(javax.naming.directory.Attribute attribute)
      Construct a new instance from the supplied Attribute.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int ix, java.lang.Object attrVal)  
      boolean add​(java.lang.Object attrVal)  
      void clear()  
      java.lang.Object clone()  
      boolean contains​(java.lang.Object attrVal)  
      boolean equals​(java.lang.Object o)  
      java.lang.Object get()  
      java.lang.Object get​(int ix)
      Due to performance reasons it is not advised to iterate over the attribute's values using this method.
      javax.naming.NamingEnumeration<?> getAll()  
      javax.naming.directory.DirContext getAttributeDefinition()  
      javax.naming.directory.DirContext getAttributeSyntaxDefinition()  
      java.lang.String getID()  
      int hashCode()  
      boolean hasValuesAsNames()  
      void initValuesAsNames()  
      boolean isOrdered()  
      java.util.Iterator<java.lang.Object> iterator()  
      java.lang.Object remove​(int ix)  
      boolean remove​(java.lang.Object attrval)  
      java.lang.Object set​(int ix, java.lang.Object attrVal)  
      int size()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • NameAwareAttribute

        public NameAwareAttribute​(java.lang.String id,
                                  java.lang.Object value)
        Construct a new instance with the specified id and one value.
        Parameters:
        id - the attribute id
        value - the value to start off with
      • NameAwareAttribute

        public NameAwareAttribute​(javax.naming.directory.Attribute attribute)
        Construct a new instance from the supplied Attribute.
        Parameters:
        attribute - the Attribute to copy.
      • NameAwareAttribute

        public NameAwareAttribute​(java.lang.String id)
        Construct a new instance with the specified id and no values.
        Parameters:
        id - the attribute id
      • NameAwareAttribute

        public NameAwareAttribute​(java.lang.String id,
                                  boolean orderMatters)
        Construct a new instance with the specified id, no values and order significance as specified.
        Parameters:
        id - the attribute id
        orderMatters - whether order has significance in this attribute.
    • Method Detail

      • getAll

        public javax.naming.NamingEnumeration<?> getAll()
        Specified by:
        getAll in interface javax.naming.directory.Attribute
      • get

        public java.lang.Object get()
        Specified by:
        get in interface javax.naming.directory.Attribute
      • size

        public int size()
        Specified by:
        size in interface javax.naming.directory.Attribute
      • getID

        public java.lang.String getID()
        Specified by:
        getID in interface javax.naming.directory.Attribute
      • contains

        public boolean contains​(java.lang.Object attrVal)
        Specified by:
        contains in interface javax.naming.directory.Attribute
      • add

        public boolean add​(java.lang.Object attrVal)
        Specified by:
        add in interface javax.naming.directory.Attribute
      • initValuesAsNames

        public void initValuesAsNames()
      • hasValuesAsNames

        public boolean hasValuesAsNames()
      • remove

        public boolean remove​(java.lang.Object attrval)
        Specified by:
        remove in interface javax.naming.directory.Attribute
      • clear

        public void clear()
        Specified by:
        clear in interface javax.naming.directory.Attribute
      • getAttributeSyntaxDefinition

        public javax.naming.directory.DirContext getAttributeSyntaxDefinition()
                                                                       throws javax.naming.NamingException
        Specified by:
        getAttributeSyntaxDefinition in interface javax.naming.directory.Attribute
        Throws:
        javax.naming.NamingException
      • getAttributeDefinition

        public javax.naming.directory.DirContext getAttributeDefinition()
                                                                 throws javax.naming.NamingException
        Specified by:
        getAttributeDefinition in interface javax.naming.directory.Attribute
        Throws:
        javax.naming.NamingException
      • isOrdered

        public boolean isOrdered()
        Specified by:
        isOrdered in interface javax.naming.directory.Attribute
      • get

        public java.lang.Object get​(int ix)
                             throws javax.naming.NamingException

        Due to performance reasons it is not advised to iterate over the attribute's values using this method. Please use the iterator() instead.

        Specified by:
        get in interface javax.naming.directory.Attribute
        Throws:
        javax.naming.NamingException
      • remove

        public java.lang.Object remove​(int ix)
        Specified by:
        remove in interface javax.naming.directory.Attribute
      • add

        public void add​(int ix,
                        java.lang.Object attrVal)
        Specified by:
        add in interface javax.naming.directory.Attribute
      • set

        public java.lang.Object set​(int ix,
                                    java.lang.Object attrVal)
        Specified by:
        set in interface javax.naming.directory.Attribute
      • clone

        public java.lang.Object clone()
        Specified by:
        clone in interface javax.naming.directory.Attribute
        Overrides:
        clone in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • iterator

        public java.util.Iterator<java.lang.Object> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<java.lang.Object>