Package org.forgerock.opendj.ldap
Class Functions
java.lang.Object
org.forgerock.opendj.ldap.Functions
Common
Function implementations which may be used when parsing
attributes.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.forgerock.util.Function<ByteString, AttributeDescription, org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesAttributeDescriptions using the default schema.static org.forgerock.util.Function<ByteString, AttributeDescription, org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesAttributeDescriptions using the provided schema.static org.forgerock.util.Function<ByteString, Boolean, org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesBooleanvalues.static org.forgerock.util.Function<ByteString, X509Certificate, org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesX509Certificatevalues.static org.forgerock.util.Function<ByteString, DN, org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesDNs using the default schema.static org.forgerock.util.Function<ByteString, DN, org.forgerock.i18n.LocalizedIllegalArgumentException> byteStringToDN(Schema schema) Returns a function which parsesDNs using the provided schema.static org.forgerock.util.Function<ByteString, GeneralizedTime, org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parses generalized time strings.static org.forgerock.util.Function<ByteString, Integer, org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesIntegerstring values.static org.forgerock.util.Function<ByteString, Long, org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesLongstring values.static org.forgerock.util.Function<ByteString, String, org.forgerock.util.promise.NeverThrowsException> Returns a function which parses aByteStringas a UTF-8 encodedString.static <M,X, N, E extends Exception>
org.forgerock.util.Function<M, N, E> compose(org.forgerock.util.Function<M, X, org.forgerock.util.promise.NeverThrowsException> first, org.forgerock.util.Function<X, N, E> second) Returns the composition of two functions.static <M> org.forgerock.util.Function<M, M, org.forgerock.util.promise.NeverThrowsException> Returns a function which always returns the value that it was provided with.Returns a function which converts aStringto lower case usingStaticUtils.toLowerCase(org.forgerock.opendj.ldap.ByteSequence, java.lang.StringBuilder)and then trims it.static org.forgerock.util.Function<Object, ByteString, org.forgerock.util.promise.NeverThrowsException> Returns a function which converts anObjectto aByteStringusing theByteString.valueOfObject(Object)method.static <M,N> org.forgerock.util.Function <M, N, org.forgerock.util.promise.NeverThrowsException> returns(N constant) Creates a function that returns constant value for any input.static org.forgerock.util.Function<String, AttributeDescription, org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesAttributeDescriptions using the default schema.static org.forgerock.util.Function<String, AttributeDescription, org.forgerock.i18n.LocalizedIllegalArgumentException> stringToAttributeDescription(Schema schema) Returns a function which parsesAttributeDescriptions using the provided schema.static org.forgerock.util.Function<String, Boolean, org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesBooleanvalues.Returns a function which parsesDNs using the default schema.stringToDN(Schema schema) Returns a function which parsesDNs using the provided schema.static org.forgerock.util.Function<String, GeneralizedTime, org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parses generalized time strings.static org.forgerock.util.Function<String, Integer, org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesIntegerstring values.static org.forgerock.util.Function<String, Long, org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesLongstring values.
-
Method Details
-
returns
public static <M,N> org.forgerock.util.Function<M,N, returnsorg.forgerock.util.promise.NeverThrowsException> (N constant) Creates a function that returns constant value for any input.- Type Parameters:
M- The type of input values transformed by this function.N- The type of output values returned by this function.- Parameters:
constant- The constant value for the function to return- Returns:
- A function that always returns constant value.
-
compose
public static <M,X, org.forgerock.util.Function<M,N, E extends Exception> N, composeE> (org.forgerock.util.Function<M, X, org.forgerock.util.promise.NeverThrowsException> first, org.forgerock.util.Function<X, N, E> second) Returns the composition of two functions. The result of the first function will be passed to the second.- Type Parameters:
M- The type of input values transformed by this function.X- The type of intermediate values passed between the two functions.N- The type of output values returned by this function.E- The type of exception thrown by thesecondfunction.- Parameters:
first- The first function which will consume the input.second- The second function which will produce the result.- Returns:
- The composition.
-
identityFunction
public static <M> org.forgerock.util.Function<M,M, identityFunction()org.forgerock.util.promise.NeverThrowsException> Returns a function which always returns the value that it was provided with.- Type Parameters:
M- The type of values transformed by this function.- Returns:
- A function which always returns the value that it was provided with.
-
normalizeString
public static org.forgerock.util.Function<String,String, normalizeString()org.forgerock.util.promise.NeverThrowsException> Returns a function which converts aStringto lower case usingStaticUtils.toLowerCase(org.forgerock.opendj.ldap.ByteSequence, java.lang.StringBuilder)and then trims it.- Returns:
- A function which converts a
Stringto lower case usingStaticUtils.toLowerCase(org.forgerock.opendj.ldap.ByteSequence, java.lang.StringBuilder)and then trims it.
-
objectToByteString
public static org.forgerock.util.Function<Object,ByteString, objectToByteString()org.forgerock.util.promise.NeverThrowsException> Returns a function which converts anObjectto aByteStringusing theByteString.valueOfObject(Object)method.- Returns:
- A function which converts an
Objectto aByteString.
-
stringToAttributeDescription
public static org.forgerock.util.Function<String,AttributeDescription, stringToAttributeDescription()org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesAttributeDescriptions using the default schema. Invalid values will result in aLocalizedIllegalArgumentException.- Returns:
- A function which parses
AttributeDescriptions.
-
stringToAttributeDescription
public static org.forgerock.util.Function<String,AttributeDescription, stringToAttributeDescriptionorg.forgerock.i18n.LocalizedIllegalArgumentException> (Schema schema) Returns a function which parsesAttributeDescriptions using the provided schema. Invalid values will result in aLocalizedIllegalArgumentException.- Parameters:
schema- The schema to use for decoding attribute descriptions.- Returns:
- A function which parses
AttributeDescriptions.
-
stringToBoolean
public static org.forgerock.util.Function<String,Boolean, stringToBoolean()org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesBooleanvalues. The function will accept the values0,false,no,off,1,true,yes,on. All other values will result in aLocalizedIllegalArgumentException.- Returns:
- A function which parses
Booleanvalues.
-
stringToDN
public static org.forgerock.util.Function<String,DN, stringToDN()org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesDNs using the default schema. Invalid values will result in aLocalizedIllegalArgumentException.- Returns:
- A function which parses
DNs.
-
stringToDN
public static org.forgerock.util.Function<String,DN, stringToDNorg.forgerock.i18n.LocalizedIllegalArgumentException> (Schema schema) Returns a function which parsesDNs using the provided schema. Invalid values will result in aLocalizedIllegalArgumentException.- Parameters:
schema- The schema to use for decoding DNs.- Returns:
- A function which parses
DNs.
-
stringToGeneralizedTime
public static org.forgerock.util.Function<String,GeneralizedTime, stringToGeneralizedTime()org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parses generalized time strings. Invalid values will result in aLocalizedIllegalArgumentException.- Returns:
- A function which parses generalized time strings.
-
stringToInteger
public static org.forgerock.util.Function<String,Integer, stringToInteger()org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesIntegerstring values. Invalid values will result in aLocalizedIllegalArgumentException.- Returns:
- A function which parses
Integerstring values.
-
stringToLong
public static org.forgerock.util.Function<String,Long, stringToLong()org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesLongstring values. Invalid values will result in aLocalizedIllegalArgumentException.- Returns:
- A function which parses
Longstring values.
-
byteStringToAttributeDescription
public static org.forgerock.util.Function<ByteString,AttributeDescription, byteStringToAttributeDescription()org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesAttributeDescriptions using the default schema. Invalid values will result in aLocalizedIllegalArgumentException.- Returns:
- A function which parses
AttributeDescriptions.
-
byteStringToAttributeDescription
public static org.forgerock.util.Function<ByteString,AttributeDescription, byteStringToAttributeDescriptionorg.forgerock.i18n.LocalizedIllegalArgumentException> (Schema schema) Returns a function which parsesAttributeDescriptions using the provided schema. Invalid values will result in aLocalizedIllegalArgumentException.- Parameters:
schema- The schema to use for decoding attribute descriptions.- Returns:
- A function which parses
AttributeDescriptions.
-
byteStringToBoolean
public static org.forgerock.util.Function<ByteString,Boolean, byteStringToBoolean()org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesBooleanvalues. The function will accept the values0,false,no,off,1,true,yes,on. All other values will result in aLocalizedIllegalArgumentException.- Returns:
- A function which parses
Booleanvalues.
-
byteStringToDN
public static org.forgerock.util.Function<ByteString,DN, byteStringToDN()org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesDNs using the default schema. Invalid values will result in aLocalizedIllegalArgumentException.- Returns:
- A function which parses
DNs.
-
byteStringToDN
public static org.forgerock.util.Function<ByteString,DN, byteStringToDNorg.forgerock.i18n.LocalizedIllegalArgumentException> (Schema schema) Returns a function which parsesDNs using the provided schema. Invalid values will result in aLocalizedIllegalArgumentException.- Parameters:
schema- The schema to use for decoding DNs.- Returns:
- A function which parses
DNs.
-
byteStringToCertificate
public static org.forgerock.util.Function<ByteString,X509Certificate, byteStringToCertificate()org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesX509Certificatevalues. Invalid values will result in aLocalizedIllegalArgumentException.- Returns:
- A function which parses
X509Certificatevalues.
-
byteStringToGeneralizedTime
public static org.forgerock.util.Function<ByteString,GeneralizedTime, byteStringToGeneralizedTime()org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parses generalized time strings. Invalid values will result in aLocalizedIllegalArgumentException.- Returns:
- A function which parses generalized time strings.
-
byteStringToInteger
public static org.forgerock.util.Function<ByteString,Integer, byteStringToInteger()org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesIntegerstring values. Invalid values will result in aLocalizedIllegalArgumentException.- Returns:
- A function which parses
Integerstring values.
-
byteStringToLong
public static org.forgerock.util.Function<ByteString,Long, byteStringToLong()org.forgerock.i18n.LocalizedIllegalArgumentException> Returns a function which parsesLongstring values. Invalid values will result in aLocalizedIllegalArgumentException.- Returns:
- A function which parses
Longstring values.
-
byteStringToString
public static org.forgerock.util.Function<ByteString,String, byteStringToString()org.forgerock.util.promise.NeverThrowsException> Returns a function which parses aByteStringas a UTF-8 encodedString.- Returns:
- A function which parses the string representation of a
ByteStringas a UTF-8 encodedString.
-