Skip to content

Construct JLambdaMethodRef with JInvocation #56

@heruan

Description

@heruan

I need to generate this field signature:

public final StringFilter<E> firstName = this.andThen(Person::getFirstName)::apply;

I can easily generate the this.andThen(Person::getFirstName) part with:

JLambdaMethodRef lambdaMethod = new JLambdaMethodRef(personType, getterName);
JInvocation jInvocation = JExpr._this().invoke("andThen").arg(lambdaMethod);

but I can't generate a lambda method reference from this JInvocation, since I can't construct a new JLambdaMethodRef(jInvocation, "apply") nor I can generate a lambda reference with any JInvocation method, e.g. jInvocation.ref("apply") generates .apply instead of ::apply.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions