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 can I declare derived/calculated fields - ones which only have getters and not setters ? #48

Open
GoogleCodeExporter opened this issue Mar 15, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

I have some pojos which set/get 4 datetime fields - and we also have related 
fields *and* getters (not setters) which covert those date times into local 
time zone date times. Can this be supported ?

e.g.

private Date startSate; // with getter and setter - setter also coverts and 
sets startLocalDate
private LocalDateTime startLocalDate; // with just setter

Original issue reported on code.google.com by [email protected] on 7 Oct 2014 at 4:18

@GoogleCodeExporter
Copy link
Author

I realise if I dont have a field for the derived value - and calculate it in 
the getter everytime, then this will work... but it would be more efficient if 
I could store the derived values in fields to use in multiple calls to a 
getter. It depends on how often I anticipate the getters to be called.

Original comment by [email protected] on 7 Oct 2014 at 4:25

@GoogleCodeExporter
Copy link
Author

It appears you want to write your own rule that implements the "setter must 
exist unless derived field"...
you can do it through an annotation that flags those fields as derived and then 
skip them in your rule.

Hope this helps...

Original comment by [email protected] on 8 Oct 2014 at 4:30

  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

@rcriosbr
Copy link

rcriosbr commented Sep 7, 2016

#90 SetterTester and GetterTester improvement

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

No branches or pull requests

2 participants