Class Attr

    • Constructor Summary

      Constructors 
      Constructor Description
      Attr()
      Default constructor
      Attr​(String name)
      Constructs an attribute value pair with no value.
      Attr​(String name, byte[] value)
      Constructs an attribute value pair with byte array.
      Attr​(String name, byte[][] value)
      Constructs an attribute value pair with array of byte array.
      Attr​(String name, String value)
      Construct an attribute value pair with a single string value.
      Attr​(String name, String[] value)
      Construct an attribute value pair with a multiple string values.
      Attr​(org.forgerock.opendj.ldap.Attribute attr)
      Construct an attribute based on a LDAP attribute
    • Constructor Detail

      • Attr

        public Attr()
        Default constructor
      • Attr

        public Attr​(String name)
        Constructs an attribute value pair with no value.
        Parameters:
        name - attribute name
      • Attr

        public Attr​(String name,
                    String value)
        Construct an attribute value pair with a single string value.
        Parameters:
        name - the name of attribute
        value - string value of attribute
      • Attr

        public Attr​(String name,
                    String[] value)
        Construct an attribute value pair with a multiple string values.
        Parameters:
        name - the name of attribute
        value - multiple string values of attribute
      • Attr

        public Attr​(String name,
                    byte[] value)
        Constructs an attribute value pair with byte array.
        Parameters:
        name - attribute name
        value - byte array as input for value
      • Attr

        public Attr​(String name,
                    byte[][] value)
        Constructs an attribute value pair with array of byte array.
        Parameters:
        name - attribute name
        value - array of byte array as input for value
      • Attr

        public Attr​(org.forgerock.opendj.ldap.Attribute attr)
        Construct an attribute based on a LDAP attribute
        Parameters:
        attr - ldap attribute to construct from
    • Method Detail

      • toLDAPAttribute

        public org.forgerock.opendj.ldap.Attribute toLDAPAttribute()
        Map to a ldap attribute
        Returns:
        an ldap attribute
      • setValue

        public void setValue​(String value)
        Set value of an attribute
        Parameters:
        value - the attribute value to be set
      • addValue

        public void addValue​(String value)
        Add a string value to the attribute
        Parameters:
        value - value to be added to the attribute
      • addValues

        public void addValues​(String[] values)
        Add mulitple string values to the attribute
        Parameters:
        values - string values to be added to the attribute
      • removeValue

        public void removeValue​(String value)
        Remove a specified string value in the attribute
        Parameters:
        value - specified value to be remvoed from the value array
      • setValue

        public void setValue​(byte[] value)
        Set value of an attribute
        Parameters:
        value - the attribute value to be set
      • addValue

        public void addValue​(byte[] value)
        Add a byte array value to the attribute
        Parameters:
        value - byte array value to be added to the attribute
      • addValues

        public void addValues​(byte[][] values)
        Add a list byte array values to the attribute
        Parameters:
        values - of byte array values to be added to the attribute
      • removeValue

        public void removeValue​(byte[] value)
        Remove a specified string value in the attribute
        Parameters:
        value - specified value to be remvoed from the value array
      • getName

        public String getName()
        Get name of an UMS attribute
        Returns:
        name of an UMS attribute
      • getName

        public String getName​(Locale locale)
        Get name of attribute in a given Locale
        Parameters:
        locale - Given locale for the attribute name to return
        Returns:
        name of an UMS attribute
      • getName

        public static String getName​(String attrName,
                                     Locale locale)
        Get attribute name with locale input.
        Parameters:
        attrName - name of the attribute
        locale - desired locale for the attribute
        Returns:
        attribute name with locale attached for retrieval
      • getBaseName

        public String getBaseName()
        Get base name for the attribute. e.g, the base name of "cn;lang-en" or "cn;lang-ja" is "cn"
        Returns:
        basename of an attribute
      • getBaseName

        public static String getBaseName​(String attrName)
        Get base name for an attribute name. e.g, the base name of "cn;lang-en" or "cn;lang-ja" is "cn"
        Returns:
        basename of the given attribute name
      • getValue

        public String getValue()
        Get one string value of the attribute
        Returns:
        one value of the attribute
      • getStringValues

        public String[] getStringValues()
        Get the string values of the attribute
        Returns:
        the values in an string array
      • contains

        public boolean contains​(String value)
        Checks whether the given value already exist for the attribute
        Parameters:
        value - the value to check for
        Returns:
        true if the value already exists, false otherwise
      • getByteValue

        public byte[] getByteValue()
        Get one byte[] value of the attribute Returning a colletion would be better, but will not be consistent with the method getStringValues()
        Returns:
        one byte[] value
      • getByteValues

        public byte[][] getByteValues()
        Get the byte[] values of the attribute
        Returns:
        the byte[] values in array
      • contains

        public boolean contains​(byte[] value)
        Checks whether the given value already exist for the attribute
        Parameters:
        value - the value to check for
        Returns:
        true if the value already exists, false otherwise
      • size

        public int size()
        Get the number of values of the attribute
        Returns:
        The number of values of the attribute
      • clone

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

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