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.-
Method Summary
Modifier and TypeMethodDescriptionstatic AttributeDescription
byteStringToAttributeDescription
(ByteString value, Schema schema) Parses aByteString
as anAttributeDescription
using the provided schema.Returns a function which parsesBoolean
values.static X509Certificate
Parses aByteString
as aX509Certificate
.Returns a function which parsesDN
s using the default schema.byteStringToDn
(Schema schema) Returns a function which parsesDN
s using the provided schema.static Duration
byteStringToDuration
(ByteString value) Parses aByteString
as aDuration
using ourDurationUnit
parser.Returns a function which parses generalized time strings.Returns a function which parsesInteger
string values.Returns a function which parsesLong
string values.Returns a function which parsesPath
string values.static <M,
N> Function<M, N, NeverThrowsException> constant
(N constant) Creates a function that returns constant value for any input.Returns an empty action for RxJava and ForgeRock.static <T,
E extends Exception, C extends io.reactivex.rxjava3.functions.Consumer<T> & Consumer<T> & Consumer<T, E>>
CReturns an empty consumer for RxJava, JDK and ForgeRock.static <M> M
identity
(M value) Returns the provided value.static boolean
stringToBoolean
(String value) Parses aString
as aboolean
.static int
stringToInteger
(String value) Parses aString
as anint
.static long
stringToLong
(String value) Parses aString
as along
.static Path
stringToPath
(String value) static URI
stringToUri
(String value)
-
Method Details
-
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.
-
emptyConsumer
public static <T,E extends Exception, C emptyConsumer()C extends io.reactivex.rxjava3.functions.Consumer<T> & Consumer<T> & Consumer<T, E>> Returns an empty consumer for RxJava, JDK and ForgeRock.- Type Parameters:
T
- the expected value type to be consumedE
- the expected exception that may be thrownC
- type of the returned consumer- Returns:
- an empty consumer for RxJava, JDK and ForgeRock.
-
emptyAction
public static <E extends Exception,C extends io.reactivex.rxjava3.functions.Action & Action<E>> C emptyAction()Returns an empty action for RxJava and ForgeRock.- Type Parameters:
E
- the expected exception that may be thrownC
- type of the returned action- Returns:
- an empty action for RxJava and ForgeRock.
-
identity
public static <M> M identity(M value) Returns the provided value.- Type Parameters:
M
- The type of value returned by this function.- Parameters:
value
- The value to be returned.- Returns:
- The provided value.
-
stringToBoolean
Parses aString
as aboolean
. The method will accept the values0
,false
,no
,off
,1
,true
,yes
,on
. All other values will result in aLocalizedIllegalArgumentException
.- Parameters:
value
- The value to be parsed.- Returns:
- The parsed
boolean
.
-
stringToInteger
Parses aString
as anint
. Invalid values will result in aLocalizedIllegalArgumentException
.- Parameters:
value
- The value to be parsed.- Returns:
- The parsed
int
.
-
stringToLong
Parses aString
as along
. Invalid values will result in aLocalizedIllegalArgumentException
.- Parameters:
value
- The value to be parsed.- Returns:
- The parsed
long
.
-
stringToPath
- Parameters:
value
- The value to be parsed.- Returns:
- The parsed
Path
.
-
stringToUri
- Parameters:
value
- The value to be parsed.- Returns:
- The parsed
Path
.
-
byteStringToAttributeDescription
public static AttributeDescription byteStringToAttributeDescription(ByteString value, Schema schema) Parses aByteString
as anAttributeDescription
using the provided schema. Invalid values will result in aLocalizedIllegalArgumentException
.- Parameters:
value
- The value to be parsed.schema
- The schema to use for decoding attribute descriptions.- Returns:
- The parsed
AttributeDescription
s.
-
byteStringToBoolean
Returns a function which parsesBoolean
values. 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
Boolean
values.
-
byteStringToDn
Returns a function which parsesDN
s using the default schema. Invalid values will result in aLocalizedIllegalArgumentException
.- Returns:
- A function which parses
DN
s.
-
byteStringToDn
public static Function<ByteString,Dn, byteStringToDnLocalizedIllegalArgumentException> (Schema schema) Returns a function which parsesDN
s using the provided schema. Invalid values will result in aLocalizedIllegalArgumentException
.- Parameters:
schema
- The schema to use for decoding DNs.- Returns:
- A function which parses
DN
s.
-
byteStringToDuration
Parses aByteString
as aDuration
using ourDurationUnit
parser. Invalid values will result in aLocalizedIllegalArgumentException
- Parameters:
value
- The value to be parsed.- Returns:
- The parsed
Duration
-
byteStringToCertificate
Parses aByteString
as aX509Certificate
. Invalid values will result in aLocalizedIllegalArgumentException
.- Parameters:
value
- The value to be parsed.- Returns:
- The parsed
X509Certificate
.
-
byteStringToGeneralizedTime
public static Function<ByteString,GeneralizedTime, byteStringToGeneralizedTime()LocalizedIllegalArgumentException> Returns a function which parses generalized time strings. Invalid values will result in aLocalizedIllegalArgumentException
.- Returns:
- A function which parses generalized time strings.
-
byteStringToInteger
Returns a function which parsesInteger
string values. Invalid values will result in aLocalizedIllegalArgumentException
.- Returns:
- A function which parses
Integer
string values.
-
byteStringToLong
Returns a function which parsesLong
string values. Invalid values will result in aLocalizedIllegalArgumentException
.- Returns:
- A function which parses
Long
string values.
-
byteStringToPath
Returns a function which parsesPath
string values. Invalid values will result in aLocalizedIllegalArgumentException
.- Returns:
- A function which parses
Path
string values.
-