Class RawAttribute

  • Direct Known Subclasses:
    LDAPAttribute

    @PublicAPI(stability=UNCOMMITTED,
               mayInstantiate=true,
               mayExtend=false,
               mayInvoke=true)
    public abstract class RawAttribute
    extends Object
    This class defines a raw attribute, which has a type (which may include zero or more options), and zero or more values. It is an unprocessed element, so it will not have undergone any syntax or other forms of validity checking.
    • Constructor Detail

      • RawAttribute

        public RawAttribute()
    • Method Detail

      • create

        public static RawAttribute create​(String attributeType)
        Creates a new raw attribute with the provided type and no values.
        Parameters:
        attributeType - The attribute type for this attribute. It must not be null.
        Returns:
        The created raw attribute.
      • create

        public static RawAttribute create​(String attributeType,
                                          String value)
        Creates a new raw attribute with the provided type value.
        Parameters:
        attributeType - The attribute type for this attribute. It must not be null.
        value - The value to use for this attribute. It must not be null.
        Returns:
        The created raw attribute.
      • create

        public static RawAttribute create​(String attributeType,
                                          ByteString value)
        Creates a new raw attribute with the provided type value.
        Parameters:
        attributeType - The attribute type for this attribute. It must not be null.
        value - The value to use for this attribute. It must not be null.
        Returns:
        The created raw attribute.
      • create

        public static RawAttribute create​(String attributeType,
                                          ArrayList<ByteString> values)
        Creates a new raw attribute with the provided type and values.
        Parameters:
        attributeType - The attribute type for this attribute. It must not be null.
        values - The set of values for this attribute.
        Returns:
        The created raw attribute.
      • create

        public static RawAttribute create​(Attribute attribute)
        Creates a new raw attribute from the provided attribute.
        Parameters:
        attribute - The attribute to use to create this raw attribute. It must not be null.
        Returns:
        The created raw attribute.
      • getAttributeType

        public abstract String getAttributeType()
        Retrieves the attribute type for this attribute.
        Returns:
        The attribute type for this attribute.
      • setAttributeType

        public abstract void setAttributeType​(String attributeType)
        Specifies the attribute type for this attribute.
        Parameters:
        attributeType - The attribute type for this attribute.
      • getValues

        public abstract List<ByteString> getValues()
        Retrieves the set of values for this attribute. The returned list may be modified by the caller.
        Returns:
        The set of values for this attribute.
      • toAttribute

        public abstract Attribute toAttribute()
                                       throws LDAPException
        Retrieves a core attribute containing the information for this raw attribute.
        Returns:
        A core attribute containing the information for this raw attribute.
        Throws:
        LDAPException - If the provided value is invalid according to the attribute syntax.
      • write

        public void write​(ASN1Writer stream)
                   throws IOException
        Writes this attribute to an ASN.1 output stream.
        Parameters:
        stream - The ASN.1 output stream to write to.
        Throws:
        IOException - If a problem occurs while writing to the stream.
      • decode

        public static LDAPAttribute decode​(ASN1Reader reader)
                                    throws LDAPException
        Decodes the elements from the provided ASN.1 reader as an LDAP attribute.
        Parameters:
        reader - The ASN.1 reader.
        Returns:
        The decoded LDAP attribute.
        Throws:
        LDAPException - If a problem occurs while trying to decode the provided ASN.1 element as a raw attribute.
      • toString

        public String toString()
        Retrieves a string representation of this attribute.
        Overrides:
        toString in class Object
        Returns:
        A string representation of this attribute.
      • toString

        public abstract void toString​(StringBuilder buffer)
        Appends a string representation of this attribute to the provided buffer.
        Parameters:
        buffer - The buffer to which the information should be appended.
      • toString

        public abstract void toString​(StringBuilder buffer,
                                      int indent)
        Appends a multi-line string representation of this LDAP attribute to the provided buffer.
        Parameters:
        buffer - The buffer to which the information should be appended.
        indent - The number of spaces from the margin that the lines should be indented.