Class TypeDescriptors
java.lang.Object
io.micronaut.expressions.parser.ast.util.TypeDescriptors
Set of constants and utility methods for working with type descriptors
while compiling evaluated expressions.
- Since:
- 4.0.0
- Author:
- Sergey Gavrilov
-
Field Summary
Modifier and TypeFieldDescriptionstatic final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final Map<org.objectweb.asm.Type,
org.objectweb.asm.Type> static final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final org.objectweb.asm.Type
static final Map<org.objectweb.asm.Type,
org.objectweb.asm.Type> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull org.objectweb.asm.Type
computeNumericOperationTargetType
(@NonNull org.objectweb.asm.Type leftOperandType, @NonNull org.objectweb.asm.Type rightOperandType) For two passed types computes result numeric operation type.static boolean
Checks if passed type is either boolean primitive or wrapper.static @io.micronaut.core.annotation.NonNull boolean
Checks if passed type is one of numeric primitives or numeric wrappers.static boolean
isOneOf
(org.objectweb.asm.Type type, org.objectweb.asm.Type... comparedTypes) Utility method to check if passed type (first argument) is the same as any of compared types (second and following args).static boolean
isPrimitive
(@NonNull org.objectweb.asm.Type type) Checks if passed type is a primitive.static @NonNull org.objectweb.asm.Type
toBoxedIfNecessary
(@NonNull org.objectweb.asm.Type type) If passed type is primitive, returns responsive boxed type, otherwise returns original passed type.static @NonNull org.objectweb.asm.Type
toUnboxedIfNecessary
(@NonNull org.objectweb.asm.Type type) If passed type is boxed type, returns responsive primitive, otherwise returns original passed type.
-
Field Details
-
EVALUATION_CONTEXT_TYPE
public static final org.objectweb.asm.Type EVALUATION_CONTEXT_TYPE -
STRING
public static final org.objectweb.asm.Type STRING -
OBJECT
public static final org.objectweb.asm.Type OBJECT -
CLASS
public static final org.objectweb.asm.Type CLASS -
VOID
public static final org.objectweb.asm.Type VOID -
DOUBLE
public static final org.objectweb.asm.Type DOUBLE -
FLOAT
public static final org.objectweb.asm.Type FLOAT -
INT
public static final org.objectweb.asm.Type INT -
LONG
public static final org.objectweb.asm.Type LONG -
BOOLEAN
public static final org.objectweb.asm.Type BOOLEAN -
CHAR
public static final org.objectweb.asm.Type CHAR -
SHORT
public static final org.objectweb.asm.Type SHORT -
BYTE
public static final org.objectweb.asm.Type BYTE -
BOOLEAN_WRAPPER
public static final org.objectweb.asm.Type BOOLEAN_WRAPPER -
INT_WRAPPER
public static final org.objectweb.asm.Type INT_WRAPPER -
LONG_WRAPPER
public static final org.objectweb.asm.Type LONG_WRAPPER -
DOUBLE_WRAPPER
public static final org.objectweb.asm.Type DOUBLE_WRAPPER -
FLOAT_WRAPPER
public static final org.objectweb.asm.Type FLOAT_WRAPPER -
SHORT_WRAPPER
public static final org.objectweb.asm.Type SHORT_WRAPPER -
BYTE_WRAPPER
public static final org.objectweb.asm.Type BYTE_WRAPPER -
CHAR_WRAPPER
public static final org.objectweb.asm.Type CHAR_WRAPPER -
PRIMITIVE_TO_WRAPPER
-
WRAPPER_TO_PRIMITIVE
-
-
Constructor Details
-
TypeDescriptors
public TypeDescriptors()
-
-
Method Details
-
isPrimitive
Checks if passed type is a primitive.- Parameters:
type
- type to check- Returns:
- true if it is
-
isBoolean
Checks if passed type is either boolean primitive or wrapper.- Parameters:
type
- type to check- Returns:
- true if it is
-
isNumeric
@NonNull public static @io.micronaut.core.annotation.NonNull boolean isNumeric(@NonNull @NonNull org.objectweb.asm.Type type) Checks if passed type is one of numeric primitives or numeric wrappers.- Parameters:
type
- type to check- Returns:
- true if it is
-
toUnboxedIfNecessary
@NonNull public static @NonNull org.objectweb.asm.Type toUnboxedIfNecessary(@NonNull @NonNull org.objectweb.asm.Type type) If passed type is boxed type, returns responsive primitive, otherwise returns original passed type.- Parameters:
type
- type to check- Returns:
- unboxed type or original passed type
-
toBoxedIfNecessary
@NonNull public static @NonNull org.objectweb.asm.Type toBoxedIfNecessary(@NonNull @NonNull org.objectweb.asm.Type type) If passed type is primitive, returns responsive boxed type, otherwise returns original passed type.- Parameters:
type
- type to check- Returns:
- boxed type or original passed type
-
computeNumericOperationTargetType
@NonNull public static @NonNull org.objectweb.asm.Type computeNumericOperationTargetType(@NonNull @NonNull org.objectweb.asm.Type leftOperandType, @NonNull @NonNull org.objectweb.asm.Type rightOperandType) For two passed types computes result numeric operation type. This method accepts both primitive and wrapper types, but returns only primitive type.- Parameters:
leftOperandType
- left operand typerightOperandType
- right operand type- Returns:
- numeric operation result type
- Throws:
ExpressionCompilationException
- if ony of the passed types is not a numeric type
-
isOneOf
public static boolean isOneOf(org.objectweb.asm.Type type, org.objectweb.asm.Type... comparedTypes) Utility method to check if passed type (first argument) is the same as any of compared types (second and following args).- Parameters:
type
- type to checkcomparedTypes
- types against which checked types is compared- Returns:
- true if checked type is amount compared types
-