org.springframework.ldap.core

## Class NameAwareAttribute

- java.lang.Object
- - org.springframework.ldap.core.NameAwareAttribute

- All Implemented Interfaces:
    Serializable, Cloneable, Iterable<Object>, Attribute

      public final class NameAwareAttribute
      extends Object
      implements Attribute, Iterable<Object>

  Used internally to make DirContextAdapter properly handle Names as values.
  Since:
    2.0
  Author:
    Mattias Hellborg Arthursson
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from interface javax.naming.directory.Attribute

      `serialVersionUID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NameAwareAttribute(Attribute attribute)` Construct a new instance from the supplied Attribute.
    `NameAwareAttribute(String id)` Construct a new instance with the specified id and no values.
    `NameAwareAttribute(String id, boolean orderMatters)` Construct a new instance with the specified id, no values and order significance as specified.
    `NameAwareAttribute(String id, Object value)` Construct a new instance with the specified id and one value.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(int ix, Object attrVal)`
    `boolean` | `add(Object attrVal)`
    `void` | `clear()`
    `Object` | `clone()`
    `boolean` | `contains(Object attrVal)`
    `boolean` | `equals(Object o)`
    `Object` | `get()`
    `Object` | `get(int ix)` Due to performance reasons it is not advised to iterate over the attribute's values using this method.
    `NamingEnumeration<?>` | `getAll()`
    `DirContext` | `getAttributeDefinition()`
    `DirContext` | `getAttributeSyntaxDefinition()`
    `String` | `getID()`
    `int` | `hashCode()`
    `boolean` | `hasValuesAsNames()`
    `void` | `initValuesAsNames()`
    `boolean` | `isOrdered()`
    `Iterator<Object>` | `iterator()`
    `Object` | `remove(int ix)`
    `boolean` | `remove(Object attrval)`
    `Object` | `set(int ix, Object attrVal)`
    `int` | `size()`
    `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(String id,
                                    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(Attribute attribute)

      Construct a new instance from the supplied Attribute.
      Parameters:
        `attribute` - the Attribute to copy.

    - #### NameAwareAttribute

          public NameAwareAttribute(String id)

      Construct a new instance with the specified id and no values.
      Parameters:
        `id` - the attribute id

    - #### NameAwareAttribute

          public NameAwareAttribute(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 NamingEnumeration<?> getAll()

      Specified by:
        `getAll` in interface `Attribute`

    - #### get

          public Object get()

      Specified by:
        `get` in interface `Attribute`

    - #### size

          public int size()

      Specified by:
        `size` in interface `Attribute`

    - #### getID

          public String getID()

      Specified by:
        `getID` in interface `Attribute`

    - #### contains

          public boolean contains(Object attrVal)

      Specified by:
        `contains` in interface `Attribute`

    - #### add

          public boolean add(Object attrVal)

      Specified by:
        `add` in interface `Attribute`

    - #### initValuesAsNames

          public void initValuesAsNames()

    - #### hasValuesAsNames

          public boolean hasValuesAsNames()

    - #### remove

          public boolean remove(Object attrval)

      Specified by:
        `remove` in interface `Attribute`

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `Attribute`

    - #### getAttributeSyntaxDefinition

          public DirContext getAttributeSyntaxDefinition()
                                                  throws NamingException

      Specified by:
        `getAttributeSyntaxDefinition` in interface `Attribute`
      Throws:
        `NamingException`

    - #### getAttributeDefinition

          public DirContext getAttributeDefinition()
                                            throws NamingException

      Specified by:
        `getAttributeDefinition` in interface `Attribute`
      Throws:
        `NamingException`

    - #### isOrdered

          public boolean isOrdered()

      Specified by:
        `isOrdered` in interface `Attribute`

    - #### get

          public Object get(int ix)
                     throws 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 `Attribute`
      Throws:
        `NamingException`

    - #### remove

          public Object remove(int ix)

      Specified by:
        `remove` in interface `Attribute`

    - #### add

          public void add(int ix,
                          Object attrVal)

      Specified by:
        `add` in interface `Attribute`

    - #### set

          public Object set(int ix,
                            Object attrVal)

      Specified by:
        `set` in interface `Attribute`

    - #### clone

          public Object clone()

      Specified by:
        `clone` in interface `Attribute`
      Overrides:
        `clone` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### iterator

          public Iterator<Object> iterator()

      Specified by:
        `iterator` in interface `Iterable<Object>`