Class DefaultRDnNormalizer

  • All Implemented Interfaces:
    RDnNormalizer

    public class DefaultRDnNormalizer
    extends Object
    implements RDnNormalizer
    Normalizes a RDN by performing the following operations:
    • lowercase attribute names
    • lowercase attribute values
    • compress duplicate spaces in attribute values
    • escape attribute value characters
    • sort multi value RDNs by name
    This API provides properties to control attribute name normalization, attribute value normalization and attribute value escaping in order to customize the behavior. Note that attribute value normalization occurs before escaping.
    • Field Detail

      • LOWERCASE

        public static final Function<String,​String> LOWERCASE
        Function that lowercases the value.
      • COMPRESS

        public static final Function<String,​String> COMPRESS
        Function that removes duplicate spaces from the value.
      • LOWERCASE_COMPRESS

        public static final Function<String,​String> LOWERCASE_COMPRESS
        Function that lowercases and removes duplicate spaces from the value.
      • attributeNameFunction

        private final Function<String,​String> attributeNameFunction
        Attribute name function.
      • attributeValueFunction

        private final Function<String,​String> attributeValueFunction
        Attribute value function.
      • attributeValueEscaper

        private final AttributeValueEscaper attributeValueEscaper
        Attribute value escaper.
    • Constructor Detail

      • DefaultRDnNormalizer

        public DefaultRDnNormalizer()
        Creates a new default RDN normalizer.
      • DefaultRDnNormalizer

        public DefaultRDnNormalizer​(AttributeValueEscaper escaper)
        Creates a new default RDN normalizer.
        Parameters:
        escaper - to escape attribute values
      • DefaultRDnNormalizer

        public DefaultRDnNormalizer​(AttributeValueEscaper escaper,
                                    Function<String,​String> nameNormalizer,
                                    Function<String,​String> valueNormalizer)
        Creates a new default RDN normalizer.
        Parameters:
        escaper - to escape attribute values
        nameNormalizer - to normalize attribute names
        valueNormalizer - to normalize attribute values
    • Method Detail

      • getValueEscaper

        public AttributeValueEscaper getValueEscaper()
        Returns the value escaper.
        Returns:
        value escaper
      • getNameFunction

        public Function<String,​String> getNameFunction()
        Returns the attribute name function.
        Returns:
        function for attribute names
      • getValueFunction

        public Function<String,​String> getValueFunction()
        Returns the attribute value function.
        Returns:
        function for attribute values
      • normalize

        public RDn normalize​(RDn rdn)
        Description copied from interface: RDnNormalizer
        Normalize the name value pairs in the supplied RDN.
        Specified by:
        normalize in interface RDnNormalizer
        Parameters:
        rdn - to normalize
        Returns:
        new normalized RDN