aboutsummaryrefslogtreecommitdiff
path: root/website2/usageExamples/ConstructorExample_post.jpage
blob: 8a2d5069fe9ce1c35e76148b905c0b49fe66e470 (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
25
26
27
28
public class ConstructorExample<T> {
	private int x, y;
	@NonNull private T description;
	
	private ConstructorExample(T description) {
		if (description == null) throw new NullPointerException("description");
		this.description = description;
	}
	
	public static <T> ConstructorExample<T> of(T description) {
		return new ConstructorExample<T>(description);
	}
	
	@java.beans.ConstructorProperties({"x", "y", "description"})
	protected ConstructorExample(int x, int y, T description) {
		if (description == null) throw new NullPointerException("description");
		this.x = x;
		this.y = y;
		this.description = description;
	}
	
	public static class NoArgsExample {
		@NonNull private String field;
		
		public NoArgsExample() {
		}
	}
}