aboutsummaryrefslogtreecommitdiff
path: root/usage_examples/onXExample_pre.jpage
blob: 1bab38359e3faa05bc86c0a7c9eaf79be5d90026 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import com.google.inject.Inject;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import org.hibernate.validator.Min;

public class OnMethodOnParamExample {
	@Getter(onMethod=@Deprecated) private int bananas;
	@Setter(onMethod=@Min(10)) private int radishes;
	
	@Override public String toString() {
		return String.format("I have %d bananas and %d beautiful radishes", bananas, radishes);
	}
}

@RequiredArgsConstructor(onConstructor=@Inject)
class OnConstructorExample {
	private final Fireman fireman;
	@Setter(onParam=@SuppressWarnings("all")) private int fires = 10;
	
	@Override public String toString() {
		return String.format("Fireman: %s has %d fires", fireman, fires);
	}
}