Class Functions

    • Method Detail

      • constant

        public static <M,​N> Function<M,​N,​NeverThrowsException> constant​(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.
      • emptyConsumer

        public static <T,​E extends Exception,​C extends io.reactivex.rxjava3.functions.Consumer<T> & Consumer<T> & Consumer<T,​E>> C emptyConsumer()
        Returns an empty consumer for RxJava, JDK and ForgeRock.
        Type Parameters:
        T - the expected value type to be consumed
        E - the expected exception that may be thrown
        C - 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 thrown
        C - 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

        public static boolean stringToBoolean​(String value)
        Parses a String as a boolean. The method will accept the values 0, false, no, off, 1, true, yes, on. All other values will result in a LocalizedIllegalArgumentException.
        Parameters:
        value - The value to be parsed.
        Returns:
        The parsed boolean.
      • stringToInteger

        public static int stringToInteger​(String value)
        Parses a String as an int. Invalid values will result in a LocalizedIllegalArgumentException.
        Parameters:
        value - The value to be parsed.
        Returns:
        The parsed int.
      • stringToLong

        public static long stringToLong​(String value)
        Parses a String as a long. Invalid values will result in a LocalizedIllegalArgumentException.
        Parameters:
        value - The value to be parsed.
        Returns:
        The parsed long.
      • byteStringToAttributeDescription

        public static AttributeDescription byteStringToAttributeDescription​(ByteString value,
                                                                            Schema schema)
        Parses a ByteString as an AttributeDescription using the provided schema. Invalid values will result in a LocalizedIllegalArgumentException.
        Parameters:
        value - The value to be parsed.
        schema - The schema to use for decoding attribute descriptions.
        Returns:
        The parsed AttributeDescriptions.
      • byteStringToBoolean

        public static Function<ByteString,​Boolean,​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 Function<ByteString,​Dn,​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 Function<ByteString,​Dn,​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.
      • byteStringToDuration

        public static Duration byteStringToDuration​(ByteString value)
        Parses a ByteString as a Duration using our DurationUnit parser. Invalid values will result in a LocalizedIllegalArgumentException
        Parameters:
        value - The value to be parsed.
        Returns:
        The parsed Duration
      • byteStringToCertificate

        public static X509Certificate byteStringToCertificate​(ByteString value)
        Parses a ByteString as a X509Certificate. Invalid values will result in a LocalizedIllegalArgumentException.
        Parameters:
        value - The value to be parsed.
        Returns:
        The parsed X509Certificate.
      • byteStringToGeneralizedTime

        public static Function<ByteString,​GeneralizedTime,​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 Function<ByteString,​Integer,​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 Function<ByteString,​Long,​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.