Class ELSupport
java.lang.Object
io.micronaut.el.runtime.ELSupport
The type conversion, comparison and emptiness rules of the Jakarta Expression Language specification.
This class is invoked by the expressions generated at compilation time, it is not part of the public API of the module.
- Since:
- 1.0
- Author:
- Denis Stepanov
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable Objectstatic intargumentCount(@Nullable Object[] arguments) static <T> @Nullable TCoerces a value applying the standard rules of the specification.static @Nullable ObjectcoerceToArray(@Nullable Object value, Class<?> componentType) Coerces a value to an array as described in the section 1.25.7 of the specification.static @Nullable BooleancoerceToBoolean(@Nullable Object value, boolean primitive) Coerces a value toBooleanas described in the section 1.25.5 of the specification.static @Nullable CharactercoerceToCharacter(@Nullable Object value, boolean primitive) Coerces a value toCharacteras described in the section 1.25.4 of the specification.static <T extends Enum<T>>
@Nullable TcoerceToEnum(@Nullable Object value, Class<T> type) Coerces a value to an enum as described in the section 1.25.6 of the specification.static <T> @Nullable TcoerceToFunctionalInterface(@Nullable jakarta.el.ELContext context, @Nullable Object value, @Nullable Class<T> type) Coerces a value to a functional interface, invoking the lambda expression when one is given.static @Nullable NumbercoerceToNumber(@Nullable Object value, Class<?> type) Coerces a value to a number type as described in the section 1.25.3 of the specification.static StringcoerceToString(@Nullable Object value) Coerces a value toStringas described in the section 1.25.2 of the specification.static <T> @Nullable TcoerceToType(@Nullable jakarta.el.ELContext context, @Nullable Object value, @Nullable Class<T> type) Coerces a value applying the custom converters of the context before the standard rules.static intCompares two values as described in the section 1.9.1 of the specification.static booleanThe==operator described in the section 1.9.2 of the specification.static booleangreaterThan(@Nullable Object left, @Nullable Object right) The>operator described in the section 1.9.1 of the specification.static booleangreaterThanOrEqual(@Nullable Object left, @Nullable Object right) The>=operator described in the section 1.9.1 of the specification.static booleanTheemptyoperator described in the section 1.11 of the specification.static booleanisFloatingPoint(@Nullable Object value) static booleanisFloatingPointInstance(@Nullable Object left, @Nullable Object right) static booleanisFloatingPointNotation(String value) static booleanisFloatingPointOperand(@Nullable Object left, @Nullable Object right) static booleanstatic booleanThe<operator described in the section 1.9.1 of the specification.static booleanlessThanOrEqual(@Nullable Object left, @Nullable Object right) The<=operator described in the section 1.9.1 of the specification.static booleanThe unarynotoperator described in the section 1.10.2 of the specification.static booleanThe!=operator described in the section 1.9.2 of the specification.static @Nullable ObjectThe semicolon operator described in the section 1.14 of the specification.static booleanCoerces a value to a primitiveboolean, the form used by the logical operators.
-
Method Details
-
coerceToType
public static <T> @Nullable T coerceToType(@Nullable jakarta.el.ELContext context, @Nullable Object value, @Nullable Class<T> type) Coerces a value applying the custom converters of the context before the standard rules.- Type Parameters:
T- The target type- Parameters:
context- The context, can benullvalue- The valuetype- The target type- Returns:
- The coerced value
-
coerce
-
coerceToFunctionalInterface
public static <T> @Nullable T coerceToFunctionalInterface(@Nullable jakarta.el.ELContext context, @Nullable Object value, @Nullable Class<T> type) Coerces a value to a functional interface, invoking the lambda expression when one is given.- Type Parameters:
T- The target type- Parameters:
context- The contextvalue- The valuetype- The functional interface- Returns:
- The coerced value
-
coerceToString
-
coerceToBoolean
-
toBoolean
Coerces a value to a primitiveboolean, the form used by the logical operators.- Parameters:
value- The value- Returns:
- The coerced value
-
coerceToCharacter
-
coerceToNumber
-
coerceToEnum
-
coerceToArray
-
isEmpty
Theemptyoperator described in the section 1.11 of the specification.- Parameters:
value- The value- Returns:
- True if the value is considered empty
-
argumentCount
- Parameters:
arguments- The arguments- Returns:
- The number of arguments, zero when the array is
null
-
argument
-
not
The unarynotoperator described in the section 1.10.2 of the specification.- Parameters:
value- The operand- Returns:
- The negated value
-
sequence
The semicolon operator described in the section 1.14 of the specification. Both operands are evaluated from left to right and the value of the left operand is discarded.- Parameters:
discarded- The value of the left operandvalue- The value of the right operand- Returns:
- The value of the right operand
-
equals
-
notEquals
-
lessThan
-
greaterThan
-
lessThanOrEqual
-
greaterThanOrEqual
-
compare
-
isFloatingPointInstance
The floating point rule of the relational operators, which the sections 1.9.1 and 1.9.2 of the specification restrict to actualFloatandDoubleinstances. Only the arithmetic operators of the section 1.7 extend it to strings in floating point notation.- Parameters:
left- The left operandright- The right operand- Returns:
- True when one of the operands is a Float or a Double
-
isFloatingPointOperand
-
isFloatingPoint
- Parameters:
value- The value- Returns:
- True when the value is a floating point value, including a string in floating point notation
-
isFloatingPointNotation
- Parameters:
value- The value- Returns:
- True when the string uses the floating point notation
-
isOperand
-