View Javadoc
1   /*
2    *    Copyright 2009-2023 the original author or authors.
3    *
4    *    Licensed under the Apache License, Version 2.0 (the "License");
5    *    you may not use this file except in compliance with the License.
6    *    You may obtain a copy of the License at
7    *
8    *       https://www.apache.org/licenses/LICENSE-2.0
9    *
10   *    Unless required by applicable law or agreed to in writing, software
11   *    distributed under the License is distributed on an "AS IS" BASIS,
12   *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *    See the License for the specific language governing permissions and
14   *    limitations under the License.
15   */
16  package org.apache.ibatis.submitted.extends_with_constructor;
17  
18  import java.util.LinkedList;
19  import java.util.List;
20  
21  public class StudentConstructor {
22    public enum Constructor {
23      ID, ID_NAME
24    }
25  
26    private List<Constructor> constructors = new LinkedList<>();
27    private final int id;
28    private String name;
29    private Teacher teacher;
30  
31    public StudentConstructor(Integer id) {
32      constructors.add(Constructor.ID);
33      this.id = id;
34    }
35  
36    public StudentConstructor(Integer id, String name) {
37      constructors.add(Constructor.ID_NAME);
38      this.id = id;
39      this.name = name;
40    }
41  
42    public int getId() {
43      return id;
44    }
45  
46    public String getName() {
47      return name;
48    }
49  
50    public void setName(String name) {
51      this.name = name;
52    }
53  
54    public Teacher getTeacher() {
55      return teacher;
56    }
57  
58    public void setTeacher(Teacher teacher) {
59      this.teacher = teacher;
60    }
61  
62    public List<Constructor> getConstructors() {
63      return constructors;
64    }
65  }