Package org.apache.logging.log4j.util
Class LambdaUtil
- java.lang.Object
-
- org.apache.logging.log4j.util.LambdaUtil
-
public final class LambdaUtil extends Object
Utility class for lambda support.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Messageget(MessageSupplier supplier)Returns the Message supplied by the specified function.static Objectget(Supplier<?> supplier)Returns the result of evaluating the specified function.static Object[]getAll(Supplier<?>... suppliers)Converts an array of lambda expressions into an array of their evaluation results.static MessagegetMessage(Supplier<?> supplier, MessageFactory messageFactory)Returns a Message, either the value supplied by the specified function, or a new Message created by the specified Factory.
-
-
-
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 ornull- Returns:
- an array containing the results of evaluating the lambda expressions (or
nullif the suppliers array wasnull
-
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#getFormattedMessageon that Message.- Parameters:
supplier- a lambda expression ornull- Returns:
- the results of evaluating the lambda expression (or
nullif the supplier wasnull
-
get
public static Message get(MessageSupplier supplier)
Returns the Message supplied by the specified function.- Parameters:
supplier- a lambda expression ornull- Returns:
- the Message resulting from evaluating the lambda expression (or
nullif the supplier wasnull
-
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 ornull- 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
-
-