Package io.micronaut.sourcegen.model
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)
forFunction
implementationimplementation
- 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
A type that represents a lambda.
Use
LambdaDef.implement(io.micronaut.sourcegen.model.MethodDef.MethodBodyBuilder)
to create an instance of ExpressionDef.Lambda
.- Since:
- 1.7
- Author:
- Andriy Dmytruk
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micronaut.sourcegen.model.ExpressionDef
ExpressionDef.And, ExpressionDef.ArrayElement, ExpressionDef.Cast, ExpressionDef.ComparisonOperation, ExpressionDef.ConditionExpressionDef, ExpressionDef.Constant, ExpressionDef.EqualsReferentially, ExpressionDef.EqualsStructurally, ExpressionDef.GetPropertyValue, ExpressionDef.IfElse, ExpressionDef.InstanceOf, ExpressionDef.InvokeGetClassMethod, ExpressionDef.InvokeHashCodeMethod, ExpressionDef.InvokeInstanceMethod, ExpressionDef.InvokeStaticMethod, ExpressionDef.IsFalse, ExpressionDef.IsNotNull, ExpressionDef.IsNull, ExpressionDef.IsTrue, ExpressionDef.Lambda, ExpressionDef.MathBinaryOperation, ExpressionDef.MathUnaryOperation, ExpressionDef.NewArrayInitialized, ExpressionDef.NewArrayOfSize, ExpressionDef.NewInstance, ExpressionDef.NotEqualsReferentially, ExpressionDef.NotEqualsStructurally, ExpressionDef.Or, ExpressionDef.Switch, ExpressionDef.SwitchYieldCase
-
Constructor Summary
ConstructorsConstructorDescriptionLambda
(ClassTypeDef type, MethodDef target, MethodDef implementation) Creates an instance of aLambda
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.Returns the value of theimplementation
record component.invoke
(ExpressionDef... expressions) Invoke the lambda.invoke
(List<? extends ExpressionDef> expressions) Invoke the lambda.Stream<? extends ExpressionDef>
Stream of nested expressions included in this expression.static ExpressionDef.Lambda
of
(io.micronaut.inject.ast.ClassElement lambdaClassElement, MethodDef.MethodBodyBuilder bodyBuilder) Create a lambda that extends a particular type.static ExpressionDef.Lambda
of
(ClassTypeDef lambdaType, MethodDef target, MethodDef.MethodBodyBuilder bodyBuilder) Create a lambda that extends a particular type.target()
Returns the value of thetarget
record component.final String
toString()
Returns a string representation of this record class.type()
Returns the value of thetype
record component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.micronaut.sourcegen.model.ExpressionDef
arrayElement, arrayElement, asExpressionSwitch, asStatementSwitch, asStatementSwitch, cast, cast, compare, doThrow, equalsReferentially, equalsStructurally, field, field, field, getPropertyValue, ifFalse, ifFalse, ifFalse, ifNonNull, ifNonNull, ifNonNull, ifNull, ifNull, ifNull, ifTrue, ifTrue, ifTrue, instanceOf, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invoke, invokeConstructor, invokeConstructor, invokeConstructor, invokeConstructor, invokeConstructor, invokeConstructor, invokeConstructor, invokeConstructor, invokeGetClass, invokeHashCode, isFalse, isNonNull, isNull, isTrue, math, math, newLocal, newLocal, notEqualsReferentially, notEqualsStructurally, returning, whileLoop
-
Constructor Details
-
Lambda
Creates an instance of aLambda
record class.- Parameters:
type
- the value for thetype
record componenttarget
- the value for thetarget
record componentimplementation
- the value for theimplementation
record component
-
-
Method Details
-
invoke
Invoke the lambda.- Parameters:
expressions
- The expressions- Returns:
- The method invocation
-
invoke
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 lambdatarget
- The lambda target methodbodyBuilder
- 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 frombodyBuilder
- The builder for the lambda body- Returns:
- The lambda
-
nestedExpressionsStream
Description copied from interface:ExpressionDef
Stream of nested expressions included in this expression.- Specified by:
nestedExpressionsStream
in interfaceExpressionDef
- Returns:
- The expressions
-
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. -
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. -
equals
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 withObjects::equals(Object,Object)
. -
type
Returns the value of thetype
record component.- Specified by:
type
in interfaceExpressionDef
- Returns:
- the value of the
type
record component
-
target
Returns the value of thetarget
record component.- Returns:
- the value of the
target
record component
-
implementation
Returns the value of theimplementation
record component.- Returns:
- the value of the
implementation
record component
-