Class EvaluatedExpressionCompilationUtils

java.lang.Object
io.micronaut.expressions.parser.ast.util.EvaluatedExpressionCompilationUtils

@Internal public final class EvaluatedExpressionCompilationUtils extends Object
Utility methods for used when compiling evaluated expressions.
Since:
4.0.0
Author:
Sergey Gavrilov
  • 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 parameter
      argument - checked argument
      Returns:
      whether argument is assignable to parameter
    • getRequiredClassElement

      @NonNull public static @NonNull ClassElement getRequiredClassElement(io.micronaut.sourcegen.model.TypeDef type, VisitorContext visitorContext)
      Provides ClassElement for passed type or throws exception if class element can not be provided.
      Parameters:
      type - Type element for which ClassElement needs to be obtained. This type can also represent a primitive type. In this case it will be boxed
      visitorContext - visitor context
      Returns:
      resolved class element
      Throws:
      ExpressionCompilationException - if class element can not be obtained