Class AttrSet

    • Field Detail

      • EMPTY_ATTR_SET

        public static final AttrSet EMPTY_ATTR_SET
        Empty Attribute Set.
    • Constructor Detail

      • AttrSet

        public AttrSet()
        No argument constructor
      • AttrSet

        public AttrSet​(Attr[] attrs)
        Construct attribute set given an array of attributes.
        Parameters:
        attrs - array of attributes to be defined in the attribute set
      • AttrSet

        public AttrSet​(Attr attr)
        Construct attribute set given an attribute
        Parameters:
        attr - attribute to be defined in the attribute set
      • AttrSet

        public AttrSet​(Collection<org.forgerock.opendj.ldap.Attribute> ldapAttrSet)
        Construct AttrSet from LDAPAttributeSet
        Parameters:
        ldapAttrSet - LDAP attribute set
    • Method Detail

      • add

        public void add​(Attr attr)
        Add one attribute to the AttrSet The attribute should have only string values
        Parameters:
        attr - attribute to be added to the set
      • addBinaryAttr

        public void addBinaryAttr​(Attr attr)
        Add one attribute to the AttrSet The attribute should have only byte values
        Parameters:
        attr - attribute to be added to the set
      • remove

        public void remove​(String name)
        Removes an exisiting attribute
        Parameters:
        name - attribute to be removed
      • remove

        public void remove​(String attrName,
                           String delValue)
        Remove a specified value for an attribute in the set
        Parameters:
        attrName - attribute name to be looked up
        delValue - value to be deleted for the specified attribute
      • replace

        public void replace​(Attr attr)
        Replace an existing attribute.
        Parameters:
        attr - attribute to be replaced
      • getAttributeNames

        public String[] getAttributeNames()
        Get names of attributes.
        Returns:
        Names of attributes in the set
      • getAttribute

        public Attr getAttribute​(String name)
        Gets the attribute contained in the set. If not found returns null object
        Parameters:
        name - name of the attribute to get
        Returns:
        attribute found
      • getAttributes

        public Enumeration getAttributes()
        Enumerate the attributes contained in the attribute set
        Returns:
        enmeration of attributes in the set
      • getValue

        public String getValue​(String attrName)
        Gets the first string value right from a specified attribute
        Parameters:
        attrName - name of the attribute to be queried in the set
        Returns:
        the first string value found
      • contains

        public boolean contains​(String attrName)
        Check if attrSet has this attribute
        Parameters:
        attrName - name of the attribute to be checked against the set
        Returns:
        true if found and false otherwise
      • contains

        public boolean contains​(String attrName,
                                String value)
        Check if this attrSet has the attribute with the given value
        Parameters:
        attrName - name of the attribute to be checked against the set
        value - value of the attribute the attribute should contain
        Returns:
        true if found and false otherwise
      • size

        public int size()
        Get the number of attributes in the Attribute Set
        Returns:
        number of attributes in the set
      • elementAt

        public Attr elementAt​(int index)
        Get the attribute at an index that starts from 0
        Returns:
        the attribute at the given index
      • indexOf

        public int indexOf​(String attrName)
        Gets the index for an attribute contained in the set
        Returns:
        index that is zero based. If attrName is not found in the set, this method returns -1.
      • clone

        public Object clone()
        Return a copy of the object
        Overrides:
        clone in class Object
        Returns:
        A copy of the object
      • toLDAPAttributeSet

        public Collection<org.forgerock.opendj.ldap.Attribute> toLDAPAttributeSet()
        Maps to an LDAPAttributeSet
        Returns:
        the equivalent LDAPAttributeSet
      • toString

        public String toString()
        Retrieves the string representation of an AttrSet
        Overrides:
        toString in class Object
        Returns:
        string representation of the AttrSet.