lishunli / projectlombok

Automatically exported from code.google.com/p/projectlombok
0 stars 0 forks source link

PostConstruct support without any dependency on spring or other frameworks #570

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. this is again may be enhancement and should be just out of box supported 
from your end
2.
3.

What is the expected output? What do you see instead?
If i say @PostConstruct; then simply it must get called without needing me to 
include additional jar files.

What version of the product are you using? On what operating system?
lombok 12
Windows/Linux.

Please provide any additional information below.

Original issue reported on code.google.com by venkates...@gmail.com on 1 Sep 2013 at 8:04

GoogleCodeExporter commented 9 years ago
- don't tell me what I must have done
- give me a use case
- give a clear example of the code you want generated in the form "without 
lombok", "with lombok"

I have no clue what this proposal is all about.

Original comment by r.spilker on 2 Sep 2013 at 8:16

GoogleCodeExporter commented 9 years ago
Looks like you are getting offended. Sorry my intent is to give as much 
information as i can to enrich lombok. 

My use case is: 

How would i trigger a method just after constructor. for example. 

Let us say i need to pass a confidenceLevel for a normal distribution which in 
turn calcuates should calculate zScore.

@Data(staticConstructor="of")
public class SomeStatisticClass {
private final double confidenceLevel
private double zScore
:
:
@PostConstruct
void postConstruct(){
zScore=new NormalDistribution().inverseCumulativePDF(confidenceLevel);
}
}

So basically if you make the constructor private (by means of 
@Data(staticConstructor="of")) then i wont get to see constructor code 
appearing isntt. So to calculate zScore if it can be done in postConstruct call 
as shown and if that can be automated.

I hope i have given enough information. In summary a method annotated as 
@PostConstruct should simply get called after construction.

If this is still not clear please do let me know

Original comment by venkates...@gmail.com on 2 Sep 2013 at 5:05