org.apache.logging.log4j.util

Class LambdaUtil



  • public final class LambdaUtil
    extends Object
    Utility class for lambda support.
    • Method Detail

      • getAll

        public static Object[] getAll(Supplier<?>... suppliers)
        Converts an array of lambda expressions into an array of their evaluation results.
        Parameters:
        suppliers - an array of lambda expressions or null
        Returns:
        an array containing the results of evaluating the lambda expressions (or null if the suppliers array was null
      • get

        public static Object get(Supplier<?> supplier)
        Returns the result of evaluating the specified function. If the supplied value is of type Message, this method returns the result of calling #getFormattedMessage on that Message.
        Parameters:
        supplier - a lambda expression or null
        Returns:
        the results of evaluating the lambda expression (or null if the supplier was null
      • get

        public static Message get(MessageSupplier supplier)
        Returns the Message supplied by the specified function.
        Parameters:
        supplier - a lambda expression or null
        Returns:
        the Message resulting from evaluating the lambda expression (or null if the supplier was null
      • getMessage

        public static Message getMessage(Supplier<?> supplier,
                                         MessageFactory messageFactory)
        Returns a Message, either the value supplied by the specified function, or a new Message created by the specified Factory.
        Parameters:
        supplier - a lambda expression or null
        Returns:
        the Message resulting from evaluating the lambda expression or the Message created by the factory for supplied values that are not of type Message

Copyright © 1999-2023 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.