Class RDn


  • public class RDn
    extends Object
    Relative distinguished name containing one or more name value pairs. Name value pairs are ordered from left to right such that the left-most pair is considered the first. For the RDN 'cn=Jane Doe+mail=jdoe@example.com', the first name value pair is 'cn=Jane Doe'. See RFC 4514 for more details on the string representations of RDNs.
    • Field Detail

      • HASH_CODE_SEED

        private static final int HASH_CODE_SEED
        hash code seed.
        See Also:
        Constant Field Values
      • nameValues

        private final Set<NameValue> nameValues
        Name value pairs.
    • Constructor Detail

      • RDn

        public RDn​(String rdn)
        Creates a new RDN with the supplied string.
        Parameters:
        rdn - to parse
        Throws:
        IllegalArgumentException - if rdn contains multiple RDNs or no RDNs
      • RDn

        public RDn​(String rdn,
                   DnParser parser)
        Creates a new RDN with the supplied string.
        Parameters:
        rdn - to parse
        parser - to parse dn
        Throws:
        IllegalArgumentException - if rdn contains multiple RDNs or no RDNS
      • RDn

        public RDn​(NameValue... value)
        Creates a new RDN with the supplied name value pairs.
        Parameters:
        value - to add
      • RDn

        public RDn​(Collection<NameValue> values)
        Creates a new RDN with the supplied name value pairs.
        Parameters:
        values - to add
      • RDn

        public RDn​(String attributeName,
                   String attributeValue)
        Creates a new RDN with a single name value pair.
        Parameters:
        attributeName - to add
        attributeValue - to add
    • Method Detail

      • getNameValue

        public NameValue getNameValue()
        Returns the first name value pair in this RDN.
        Returns:
        name value pair
      • getNameValues

        public Set<NameValue> getNameValues()
        Returns all the name value pairs in this RDN.
        Returns:
        name value paris
      • getNames

        public List<String> getNames()
        Returns all the names in this RDN.
        Returns:
        all names
      • getNameValues

        public Set<NameValue> getNameValues​(String name)
        Returns the name values that match the supplied name.
        Parameters:
        name - to match
        Returns:
        name values
      • getNameValue

        public NameValue getNameValue​(String name)
        Returns a single name value that matches the supplied name. See getNameValues(String).
        Parameters:
        name - to match
        Returns:
        name value
      • size

        public int size()
        Returns the number of name value pairs in this RDN.
        Returns:
        RDN size
      • isEmpty

        public boolean isEmpty()
        Returns whether this RDN contains any name values.
        Returns:
        whether this RDN contains any name values
      • isSame

        public boolean isSame​(RDn rdn)
        Returns whether the normalized format of the supplied RDN equals the normalized format of this RDN. See DefaultRDnNormalizer.
        Parameters:
        rdn - to compare
        Returns:
        whether the supplied RDN is the same as this RDN
      • isSame

        public boolean isSame​(RDn rdn,
                              RDnNormalizer normalizer)
        Returns whether the normalized format of the supplied RDN equals the normalized format of this RDN.
        Parameters:
        normalizer - to use for comparison
        rdn - to compare
        Returns:
        whether the supplied RDN is the same as this RDN
      • format

        public String format()
        Returns a string representation of this RDN. Uses a DefaultRDnNormalizer by default.
        Returns:
        string form of the RDN
      • format

        public String format​(RDnNormalizer normalizer)
        Returns a string representation of this RDN, joining each name value pair with '+'.
        Parameters:
        normalizer - to apply to the RDN components or null for no formatting
        Returns:
        string form of the RDN
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object