1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.ibatis.autoconstructor;
17
18 import org.apache.ibatis.annotations.AutomapConstructor;
19
20 public class AnnotatedSubject {
21 private final int id;
22 private final String name;
23 private final int age;
24 private final int height;
25 private final int weight;
26
27 public AnnotatedSubject(final int id, final String name, final int age, final int height, final int weight) {
28 this.id = id;
29 this.name = name;
30 this.age = age;
31 this.height = height;
32 this.weight = weight;
33 }
34
35 @AutomapConstructor
36 public AnnotatedSubject(final int id, final String name, final int age, final Integer height, final Integer weight) {
37 this.id = id;
38 this.name = name;
39 this.age = age;
40 this.height = height == null ? 0 : height;
41 this.weight = weight == null ? 0 : weight;
42 }
43 }