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

How to generate field for get method #176

Open
yswtrue opened this issue Sep 23, 2024 · 2 comments
Open

How to generate field for get method #176

yswtrue opened this issue Sep 23, 2024 · 2 comments

Comments

@yswtrue
Copy link

yswtrue commented Sep 23, 2024

A pojo like this

@Getter
@Setter
Class A {
    private Timestamp birthday;
    public Integer getAge() {
        if (this.birthday == null) {
            return null;
        }
        return DateUtil.ageOfNow(this.birthday);
    }
}

it won't generate the age field, only birthday field

@kbuntrock
Copy link
Owner

Hello @yswtrue,

First of all, I'm currently abroad very far for my computer till the end of the month. Until then, my help will be quite shallow.

I have a few questions:

  • Are the @Getter ans @Setter annotations from Lombok or something else?
  • Are you using Spring / Spring boot or something else? And which JSON serialisation library? (Jackson, gson, ...)
  • Do you have any configuration that explicitly indicate that you use getter methods for json serialisation? Or is that a default configuration of your library / framework?

Kind regards,
Kevin

@yswtrue
Copy link
Author

yswtrue commented Sep 28, 2024

Hi,

  • @Getter and @seter are Lombok annotations
  • I use spring boot and default JSON serialisation Jackson and no external config for serializations

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

2 participants