Class ELOptional<T>
java.lang.Object
io.micronaut.el.stream.ELOptional<T>
- Type Parameters:
T- The type of the value
The
Optional implementation class described in the section 2.3.3.2 of the Jakarta Expression
Language specification.- Since:
- 1.0
- Author:
- Denis Stepanov
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ELOptional<T> empty()booleanget()inthashCode()voidifPresent(jakarta.el.LambdaExpression consumer) void@Nullable ObjectinvokeOperation(jakarta.el.ELContext context, String name, Object[] arguments) Invokes one of the operations of this class, avoiding the reflective dispatch of the standard resolvers.booleanstatic <T> ELOptional<T> of(@Nullable T value) @Nullable Object@Nullable ObjectorElseGet(jakarta.el.LambdaExpression other) @Nullable ObjecttoString()
-
Method Details
-
empty
- Type Parameters:
T- The type of the value- Returns:
- An empty optional
-
of
- Type Parameters:
T- The type of the value- Parameters:
value- The value, can benull- Returns:
- An optional holding the value
-
isPresent
public boolean isPresent()- Returns:
- True if a value is present
-
get
- Returns:
- The value held by the optional
-
ifPresent
public void ifPresent(jakarta.el.LambdaExpression consumer) - Parameters:
consumer- The consumer invoked with the value when it is present
-
ifPresent
-
orElse
-
orElseGet
- Parameters:
other- The lambda expression invoked when the optional is empty- Returns:
- The value held by the optional or the result of the lambda expression
-
orElseGet
-
invokeOperation
public @Nullable Object invokeOperation(jakarta.el.ELContext context, String name, Object[] arguments) Invokes one of the operations of this class, avoiding the reflective dispatch of the standard resolvers.- Parameters:
context- The contextname- The name of the operationarguments- The arguments- Returns:
- The result of the operation
-
equals
-
hashCode
-
toString
-