View Javadoc

1   /*
2    * Copyright 2011 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may
3    * not use this file except in compliance with the License. You may obtain a copy of the License at
4    * http://www.osedu.org/licenses/ECL-2.0 Unless required by applicable law or agreed to in writing, software distributed
5    * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
6    * implied. See the License for the specific language governing permissions and limitations under the License.
7    */
8   package org.kuali.student.contract.model.test.source;
9   
10  import java.io.Serializable;
11  import java.util.List;
12  
13  import javax.xml.bind.annotation.XmlAccessType;
14  import javax.xml.bind.annotation.XmlAccessorType;
15  import javax.xml.bind.annotation.XmlAnyElement;
16  import javax.xml.bind.annotation.XmlElement;
17  import javax.xml.bind.annotation.XmlType;
18  
19  import org.kuali.student.contract.model.test.source.Attribute;
20  import org.kuali.student.contract.model.test.source.ModelBuilder;
21  import org.w3c.dom.Element;
22  
23  @XmlAccessorType(XmlAccessType.FIELD)
24  @XmlType(name = "AttributeInfo", propOrder = {"id", "key", "value", "_futureElements"})
25  public final class AttributeInfo implements Attribute, Serializable {
26  
27      private static final long serialVersionUID = 1L;
28      
29      @XmlElement
30      private final String id;
31      
32      @XmlElement
33      private final String key;
34      
35      @XmlElement
36      private final String value;
37  
38      @XmlAnyElement
39      private final List<Element> _futureElements;
40      
41      private AttributeInfo() {
42          this.id = null;
43          this.key = null;
44          this.value = null;
45          this._futureElements = null;
46      }
47  
48      private AttributeInfo(Attribute builder) {
49          this.id = builder.getId();
50          this.key = builder.getKey();
51          this.value = builder.getValue();
52          this._futureElements = null;
53      }
54  
55      @Override
56      public String getId() {
57          return id;
58      }
59  
60  
61      @Override
62      public String getKey() {
63          return key;
64      }
65  
66  
67      @Override
68      public String getValue() {
69          return value;
70      }
71  
72      
73      public static class Builder implements ModelBuilder<AttributeInfo>, Attribute {
74  
75          private String id;
76          private String value;
77          private String key;
78  
79          public Builder() {
80          }
81  
82          public Builder(Attribute attInfo) {
83              this.id = attInfo.getId();
84              this.key = attInfo.getKey();
85              this.value = attInfo.getValue();
86          }
87  
88          public AttributeInfo build() {
89              return new AttributeInfo(this);
90          }
91  
92          @Override
93          public String getId() {
94              return id;
95          }
96  
97          @Override
98          public String getKey() {
99              return key;
100         }
101 
102         @Override
103         public String getValue() {
104             return value;
105         }
106 
107         public void setId(String id) {
108             this.id = id;
109         }
110 
111         public void setKey(String key) {
112             this.key = key;
113         }
114 
115         public void setValue(String val) {
116             this.value = val;
117         }
118     }
119 }