Package org.ldaptive.dn
Class DefaultRDnNormalizer
- java.lang.Object
-
- org.ldaptive.dn.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
-
-
Field Summary
Fields Modifier and Type Field Description private Function<String,String>
attributeNameFunction
Attribute name function.private AttributeValueEscaper
attributeValueEscaper
Attribute value escaper.private Function<String,String>
attributeValueFunction
Attribute value function.static Comparator<NameValue>
COMPARE_BY_NAME
Comparator that compares name values by name.static Function<String,String>
COMPRESS
Function that removes duplicate spaces from the value.static Function<String,String>
LOWERCASE
Function that lowercases the value.static Function<String,String>
LOWERCASE_COMPRESS
Function that lowercases and removes duplicate spaces from the value.private Comparator<NameValue>
nameValueComparator
Name value comparator for sorting.
-
Constructor Summary
Constructors Constructor Description DefaultRDnNormalizer()
Creates a new default RDN normalizer.DefaultRDnNormalizer(AttributeValueEscaper escaper)
Creates a new default RDN normalizer.DefaultRDnNormalizer(AttributeValueEscaper escaper, Function<String,String> nameNormalizer, Function<String,String> valueNormalizer)
Creates a new default RDN normalizer.DefaultRDnNormalizer(AttributeValueEscaper escaper, Function<String,String> nameNormalizer, Function<String,String> valueNormalizer, Comparator<NameValue> comparator)
Creates a new default RDN normalizer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Function<String,String>
getNameFunction()
Returns the attribute name function.AttributeValueEscaper
getValueEscaper()
Returns the value escaper.Function<String,String>
getValueFunction()
Returns the attribute value function.RDn
normalize(RDn rdn)
Normalize the name value pairs in the supplied RDN.String
toString()
-
-
-
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.
-
COMPARE_BY_NAME
public static final Comparator<NameValue> COMPARE_BY_NAME
Comparator that compares name values by name.
-
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.
-
nameValueComparator
private final Comparator<NameValue> nameValueComparator
Name value comparator for sorting.
-
-
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 valuesnameNormalizer
- to normalize attribute namesvalueNormalizer
- to normalize attribute values
-
DefaultRDnNormalizer
public DefaultRDnNormalizer(AttributeValueEscaper escaper, Function<String,String> nameNormalizer, Function<String,String> valueNormalizer, Comparator<NameValue> comparator)
Creates a new default RDN normalizer.- Parameters:
escaper
- to escape attribute valuesnameNormalizer
- to normalize attribute namesvalueNormalizer
- to normalize attribute valuescomparator
- for sorting RDN name 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 interfaceRDnNormalizer
- Parameters:
rdn
- to normalize- Returns:
- new normalized RDN
-
-