Package org.apache.logging.log4j.util
Class LambdaUtil
java.lang.Object
org.apache.logging.log4j.util.LambdaUtil
Utility class for lambda support.
- Since:
- 2.4
-
Method Summary
Modifier and TypeMethodDescriptionstatic Message
get
(MessageSupplier supplier) Returns the Message supplied by the specified function.static Object
Returns the result of evaluating the specified function.static Object[]
Converts an array of lambda expressions into an array of their evaluation results.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.
-
Method Details
-
getAll
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
null
if the suppliers array wasnull
-
get
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 ornull
- Returns:
- the results of evaluating the lambda expression (or
null
if the supplier wasnull
-
get
Returns the Message supplied by the specified function.- Parameters:
supplier
- a lambda expression ornull
- Returns:
- the Message resulting from evaluating the lambda expression (or
null
if the supplier wasnull
-
getMessage
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
- Since:
- 2.6
-