Record Class ExpressionDef.Lambda

java.lang.Object
java.lang.Record
io.micronaut.sourcegen.model.ExpressionDef.Lambda
Record Components:
type - The type of the lambda, e.g. Function<String, String>
target - The target method as defined in the interface, e.g. Object apply(Object) for Function implementation
implementation - The lambda method implementation
All Implemented Interfaces:
ExpressionDef
Enclosing interface:
ExpressionDef

public static record ExpressionDef.Lambda(ClassTypeDef type, MethodDef target, MethodDef implementation) extends Record implements ExpressionDef
Since:
1.7
Author:
Andriy Dmytruk
  • Constructor Details

    • Lambda

      public Lambda(ClassTypeDef type, MethodDef target, MethodDef implementation)
      Creates an instance of a Lambda record class.
      Parameters:
      type - the value for the type record component
      target - the value for the target record component
      implementation - the value for the implementation record component
  • Method Details

    • invoke

      public ExpressionDef.InvokeInstanceMethod invoke(List<? extends ExpressionDef> expressions)
      Invoke the lambda.
      Parameters:
      expressions - The expressions
      Returns:
      The method invocation
    • invoke

      public ExpressionDef.InvokeInstanceMethod invoke(ExpressionDef... expressions)
      Invoke the lambda.
      Parameters:
      expressions - The expressions
      Returns:
      The method invocation
    • of

      public static ExpressionDef.Lambda of(ClassTypeDef lambdaType, MethodDef target, MethodDef.MethodBodyBuilder bodyBuilder)
      Create a lambda that extends a particular type.
      Parameters:
      lambdaType - The type of lambda
      target - The lambda target method
      bodyBuilder - The builder for the lambda body
      Returns:
      The lambda
    • of

      public static ExpressionDef.Lambda of(io.micronaut.inject.ast.ClassElement lambdaClassElement, MethodDef.MethodBodyBuilder bodyBuilder)
      Create a lambda that extends a particular type.
      Parameters:
      lambdaClassElement - The parent to extend from
      bodyBuilder - The builder for the lambda body
      Returns:
      The lambda
    • nestedExpressionsStream

      public Stream<? extends ExpressionDef> nestedExpressionsStream()
      Description copied from interface: ExpressionDef
      Stream of nested expressions included in this expression.
      Specified by:
      nestedExpressionsStream in interface ExpressionDef
      Returns:
      The expressions
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • type

      public ClassTypeDef type()
      Returns the value of the type record component.
      Specified by:
      type in interface ExpressionDef
      Returns:
      the value of the type record component
    • target

      public MethodDef target()
      Returns the value of the target record component.
      Returns:
      the value of the target record component
    • implementation

      public MethodDef implementation()
      Returns the value of the implementation record component.
      Returns:
      the value of the implementation record component