Class EvaluatedExpressionCompilationUtils
java.lang.Object
io.micronaut.expressions.parser.ast.util.EvaluatedExpressionCompilationUtils
Utility methods for used when compiling evaluated expressions.
- Since:
- 4.0.0
- Author:
- Sergey Gavrilov
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull ClassElement
getRequiredClassElement
(io.micronaut.sourcegen.model.TypeDef type, VisitorContext visitorContext) ProvidesClassElement
for passed type or throws exception if class element can not be provided.static boolean
isAssignable
(@NonNull ClassElement parameter, @NonNull ClassElement argument) Checks whether the argument class element is assignable to the parameter class element.
-
Constructor Details
-
EvaluatedExpressionCompilationUtils
public EvaluatedExpressionCompilationUtils()
-
-
Method Details
-
isAssignable
public static boolean isAssignable(@NonNull @NonNull ClassElement parameter, @NonNull @NonNull ClassElement argument) Checks whether the argument class element is assignable to the parameter class element. This method also accepts primitive and wrapper elements and determines whether argument can be assigned to parameter after boxing or unboxing. In case when parameter or argument is an array, array dimensions are also checked.- Parameters:
parameter
- checked parameterargument
- checked argument- Returns:
- whether argument is assignable to parameter
-
getRequiredClassElement
@NonNull public static @NonNull ClassElement getRequiredClassElement(io.micronaut.sourcegen.model.TypeDef type, VisitorContext visitorContext) ProvidesClassElement
for passed type or throws exception if class element can not be provided.- Parameters:
type
- Type element for whichClassElement
needs to be obtained. This type can also represent a primitive type. In this case it will be boxedvisitorContext
- visitor context- Returns:
- resolved class element
- Throws:
ExpressionCompilationException
- if class element can not be obtained
-