Class Functions

java.lang.Object
org.forgerock.opendj.ldap.Functions

public final class Functions extends Object
Common Function implementations which may be used when parsing attributes.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.forgerock.util.Function<ByteString,AttributeDescription,org.forgerock.i18n.LocalizedIllegalArgumentException>
    Returns a function which parses AttributeDescriptions using the default schema.
    static org.forgerock.util.Function<ByteString,AttributeDescription,org.forgerock.i18n.LocalizedIllegalArgumentException>
    Returns a function which parses AttributeDescriptions using the provided schema.
    static org.forgerock.util.Function<ByteString,Boolean,org.forgerock.i18n.LocalizedIllegalArgumentException>
    Returns a function which parses Boolean values.
    static org.forgerock.util.Function<ByteString,X509Certificate,org.forgerock.i18n.LocalizedIllegalArgumentException>
    Returns a function which parses X509Certificate values.
    static org.forgerock.util.Function<ByteString,DN,org.forgerock.i18n.LocalizedIllegalArgumentException>
    Returns a function which parses DNs using the default schema.
    static org.forgerock.util.Function<ByteString,DN,org.forgerock.i18n.LocalizedIllegalArgumentException>
    Returns a function which parses DNs 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 parses Integer string values.
    static org.forgerock.util.Function<ByteString,Long,org.forgerock.i18n.LocalizedIllegalArgumentException>
    Returns a function which parses Long string values.
    static org.forgerock.util.Function<ByteString,String,org.forgerock.util.promise.NeverThrowsException>
    Returns a function which parses a ByteString as a UTF-8 encoded String.
    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.
    static org.forgerock.util.Function<String,String,org.forgerock.util.promise.NeverThrowsException>
    Returns a function which converts a String to lower case using StaticUtils.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 an Object to a ByteString using the ByteString.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 parses AttributeDescriptions using the default schema.
    static org.forgerock.util.Function<String,AttributeDescription,org.forgerock.i18n.LocalizedIllegalArgumentException>
    Returns a function which parses AttributeDescriptions using the provided schema.
    static org.forgerock.util.Function<String,Boolean,org.forgerock.i18n.LocalizedIllegalArgumentException>
    Returns a function which parses Boolean values.
    static org.forgerock.util.Function<String,DN,org.forgerock.i18n.LocalizedIllegalArgumentException>
    Returns a function which parses DNs using the default schema.
    static org.forgerock.util.Function<String,DN,org.forgerock.i18n.LocalizedIllegalArgumentException>
    Returns a function which parses DNs 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 parses Integer string values.
    static org.forgerock.util.Function<String,Long,org.forgerock.i18n.LocalizedIllegalArgumentException>
    Returns a function which parses Long string values.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • returns

      public 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.
      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, 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. 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 the second function.
      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,org.forgerock.util.promise.NeverThrowsException> identityFunction()
      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,org.forgerock.util.promise.NeverThrowsException> normalizeString()
      Returns a function which converts a String to lower case using StaticUtils.toLowerCase(org.forgerock.opendj.ldap.ByteSequence, java.lang.StringBuilder) and then trims it.
      Returns:
      A function which converts a String to lower case using StaticUtils.toLowerCase(org.forgerock.opendj.ldap.ByteSequence, java.lang.StringBuilder) and then trims it.
    • objectToByteString

      public static org.forgerock.util.Function<Object,ByteString,org.forgerock.util.promise.NeverThrowsException> objectToByteString()
      Returns a function which converts an Object to a ByteString using the ByteString.valueOfObject(Object) method.
      Returns:
      A function which converts an Object to a ByteString .
    • stringToAttributeDescription

      public static org.forgerock.util.Function<String,AttributeDescription,org.forgerock.i18n.LocalizedIllegalArgumentException> stringToAttributeDescription()
      Returns a function which parses AttributeDescriptions using the default schema. Invalid values will result in a LocalizedIllegalArgumentException.
      Returns:
      A function which parses AttributeDescriptions.
    • stringToAttributeDescription

      public static org.forgerock.util.Function<String,AttributeDescription,org.forgerock.i18n.LocalizedIllegalArgumentException> stringToAttributeDescription(Schema schema)
      Returns a function which parses AttributeDescriptions using the provided schema. Invalid values will result in a LocalizedIllegalArgumentException.
      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,org.forgerock.i18n.LocalizedIllegalArgumentException> stringToBoolean()
      Returns a function which parses Boolean values. The function will accept the values 0, false, no, off, 1, true, yes, on. All other values will result in a LocalizedIllegalArgumentException.
      Returns:
      A function which parses Boolean values.
    • stringToDN

      public static org.forgerock.util.Function<String,DN,org.forgerock.i18n.LocalizedIllegalArgumentException> stringToDN()
      Returns a function which parses DNs using the default schema. Invalid values will result in a LocalizedIllegalArgumentException .
      Returns:
      A function which parses DNs.
    • stringToDN

      public static org.forgerock.util.Function<String,DN,org.forgerock.i18n.LocalizedIllegalArgumentException> stringToDN(Schema schema)
      Returns a function which parses DNs using the provided schema. Invalid values will result in a LocalizedIllegalArgumentException .
      Parameters:
      schema - The schema to use for decoding DNs.
      Returns:
      A function which parses DNs.
    • stringToGeneralizedTime

      public static org.forgerock.util.Function<String,GeneralizedTime,org.forgerock.i18n.LocalizedIllegalArgumentException> stringToGeneralizedTime()
      Returns a function which parses generalized time strings. Invalid values will result in a LocalizedIllegalArgumentException.
      Returns:
      A function which parses generalized time strings.
    • stringToInteger

      public static org.forgerock.util.Function<String,Integer,org.forgerock.i18n.LocalizedIllegalArgumentException> stringToInteger()
      Returns a function which parses Integer string values. Invalid values will result in a LocalizedIllegalArgumentException.
      Returns:
      A function which parses Integer string values.
    • stringToLong

      public static org.forgerock.util.Function<String,Long,org.forgerock.i18n.LocalizedIllegalArgumentException> stringToLong()
      Returns a function which parses Long string values. Invalid values will result in a LocalizedIllegalArgumentException.
      Returns:
      A function which parses Long string values.
    • byteStringToAttributeDescription

      public static org.forgerock.util.Function<ByteString,AttributeDescription,org.forgerock.i18n.LocalizedIllegalArgumentException> byteStringToAttributeDescription()
      Returns a function which parses AttributeDescriptions using the default schema. Invalid values will result in a LocalizedIllegalArgumentException.
      Returns:
      A function which parses AttributeDescriptions.
    • byteStringToAttributeDescription

      public static org.forgerock.util.Function<ByteString,AttributeDescription,org.forgerock.i18n.LocalizedIllegalArgumentException> byteStringToAttributeDescription(Schema schema)
      Returns a function which parses AttributeDescriptions using the provided schema. Invalid values will result in a LocalizedIllegalArgumentException.
      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,org.forgerock.i18n.LocalizedIllegalArgumentException> byteStringToBoolean()
      Returns a function which parses Boolean values. The function will accept the values 0, false, no, off, 1, true, yes, on. All other values will result in a LocalizedIllegalArgumentException.
      Returns:
      A function which parses Boolean values.
    • byteStringToDN

      public static org.forgerock.util.Function<ByteString,DN,org.forgerock.i18n.LocalizedIllegalArgumentException> byteStringToDN()
      Returns a function which parses DNs using the default schema. Invalid values will result in a LocalizedIllegalArgumentException .
      Returns:
      A function which parses DNs.
    • byteStringToDN

      public static org.forgerock.util.Function<ByteString,DN,org.forgerock.i18n.LocalizedIllegalArgumentException> byteStringToDN(Schema schema)
      Returns a function which parses DNs using the provided schema. Invalid values will result in a LocalizedIllegalArgumentException .
      Parameters:
      schema - The schema to use for decoding DNs.
      Returns:
      A function which parses DNs.
    • byteStringToCertificate

      public static org.forgerock.util.Function<ByteString,X509Certificate,org.forgerock.i18n.LocalizedIllegalArgumentException> byteStringToCertificate()
      Returns a function which parses X509Certificate values. Invalid values will result in a LocalizedIllegalArgumentException.
      Returns:
      A function which parses X509Certificate values.
    • byteStringToGeneralizedTime

      public static org.forgerock.util.Function<ByteString,GeneralizedTime,org.forgerock.i18n.LocalizedIllegalArgumentException> byteStringToGeneralizedTime()
      Returns a function which parses generalized time strings. Invalid values will result in a LocalizedIllegalArgumentException.
      Returns:
      A function which parses generalized time strings.
    • byteStringToInteger

      public static org.forgerock.util.Function<ByteString,Integer,org.forgerock.i18n.LocalizedIllegalArgumentException> byteStringToInteger()
      Returns a function which parses Integer string values. Invalid values will result in a LocalizedIllegalArgumentException.
      Returns:
      A function which parses Integer string values.
    • byteStringToLong

      public static org.forgerock.util.Function<ByteString,Long,org.forgerock.i18n.LocalizedIllegalArgumentException> byteStringToLong()
      Returns a function which parses Long string values. Invalid values will result in a LocalizedIllegalArgumentException.
      Returns:
      A function which parses Long string values.
    • byteStringToString

      public static org.forgerock.util.Function<ByteString,String,org.forgerock.util.promise.NeverThrowsException> byteStringToString()
      Returns a function which parses a ByteString as a UTF-8 encoded String.
      Returns:
      A function which parses the string representation of a ByteString as a UTF-8 encoded String.