Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Getter annotation on a class should support onMethod #1653

Open
danieltaub96 opened this issue Apr 11, 2018 · 8 comments
Open

@Getter annotation on a class should support onMethod #1653

danieltaub96 opened this issue Apr 11, 2018 · 8 comments
Assignees

Comments

@danieltaub96
Copy link
Contributor

danieltaub96 commented Apr 11, 2018

Hello, i'm a huge fan of lombok project,

i wondered why the functionality of onMethod are not supported on class,

as mentioned in the official doc :
"The onX parameter is not legal on any type-wide variant. For example, a @getter annotation on a class does not support onMethod"

I thinking this should be supported, for example i'm using graphql for java, and I need to put on each getter the annotation @Graphqlfield

public class Example {
    private String a;
    private Integer b;

    @GraphQLField
    public String getA() {
        return a;
    }

    @GraphQLField
    public Integer getB() {
        return b;
    }
}

Think on a class that haves a lot of getters, this all could be replaced like that

@Getter(onMethod = @__({@GraphQLField}))
public class Example {
    private String a;
    private Integer b;
}

thanks.

@rzwitserloot
Copy link
Collaborator

@rspilker is working on this now.

@rspilker
Copy link
Collaborator

Is part of the latest edge release.

@victorwss
Copy link
Contributor

@rspilker You documented it as for @Getter and @Setter. Is it for @Wither also?

@rspilker
Copy link
Collaborator

Not yet. We didn't forget about that, but wanted to release it for @Getter and @Setter first, also because we have some more plans for @Wither.

@priiduneemre
Copy link

The sentence referenced by @danieltaub96 is still present in the documentation here.

Is it documentation bug at this point, or did the feature not make it into the final release?

@rzwitserloot
Copy link
Collaborator

Sounds like a documentation bug. Re-opening and assigning.

@forresthopkinsa
Copy link

Is there an issue to track adding this to @With? This is currently a blocker for using the latest DynamoDB SDK with Lombok immutables; the withX methods need to all have @DynamoDbIgnore

@HelodieJaqueline
Copy link

HelodieJaqueline commented Jun 26, 2023

I'm using lombok 1.18.26 and get a compilation error:

[ERROR] diagnostic: C:\xxx\xxx\Myclass.java:14: error: cannot find symbol
@getter(onMethod_={@JsonIgnore})
^
Here is Myclass:

@Getter(onMethod_={@JsonIgnore})
@Setter
@JsonIgnoreProperties(ignoreUnknown = true)
@ToString
public class Myclass {
    @Min(value = 1)
    @Max(value = 2160)
    @JsonProperty(value = "id")
    private Integer id;

    @JsonProperty(value = "enable")
    private Boolean enable;
}

I'm using jdk17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants