View Javadoc

1   /**
2    * Copyright 2004-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community 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    * http://www.opensource.org/licenses/ecl2.php
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.kuali.student.contract.model.test.source;
17  
18  import java.io.Serializable;
19  import java.util.List;
20  
21  import javax.xml.bind.annotation.XmlAccessType;
22  import javax.xml.bind.annotation.XmlAccessorType;
23  import javax.xml.bind.annotation.XmlAnyElement;
24  import javax.xml.bind.annotation.XmlElement;
25  import javax.xml.bind.annotation.XmlType;
26  
27  import org.kuali.student.contract.model.test.source.Attribute;
28  import org.kuali.student.contract.model.test.source.ModelBuilder;
29  import org.w3c.dom.Element;
30  
31  @XmlAccessorType(XmlAccessType.FIELD)
32  @XmlType(name = "AttributeInfo", propOrder = {"id", "key", "value", "_futureElements"})
33  public final class AttributeInfo implements Attribute, Serializable {
34  
35      private static final long serialVersionUID = 1L;
36      
37      @XmlElement
38      private final String id;
39      
40      @XmlElement
41      private final String key;
42      
43      @XmlElement
44      private final String value;
45  
46      @XmlAnyElement
47      private final List<Element> _futureElements;
48      
49      private AttributeInfo() {
50          this.id = null;
51          this.key = null;
52          this.value = null;
53          this._futureElements = null;
54      }
55  
56      private AttributeInfo(Attribute builder) {
57          this.id = builder.getId();
58          this.key = builder.getKey();
59          this.value = builder.getValue();
60          this._futureElements = null;
61      }
62  
63      @Override
64      public String getId() {
65          return id;
66      }
67  
68  
69      @Override
70      public String getKey() {
71          return key;
72      }
73  
74  
75      @Override
76      public String getValue() {
77          return value;
78      }
79  
80      
81      public static class Builder implements ModelBuilder<AttributeInfo>, Attribute {
82  
83          private String id;
84          private String value;
85          private String key;
86  
87          public Builder() {
88          }
89  
90          public Builder(Attribute attInfo) {
91              this.id = attInfo.getId();
92              this.key = attInfo.getKey();
93              this.value = attInfo.getValue();
94          }
95  
96          public AttributeInfo build() {
97              return new AttributeInfo(this);
98          }
99  
100         @Override
101         public String getId() {
102             return id;
103         }
104 
105         @Override
106         public String getKey() {
107             return key;
108         }
109 
110         @Override
111         public String getValue() {
112             return value;
113         }
114 
115         public void setId(String id) {
116             this.id = id;
117         }
118 
119         public void setKey(String key) {
120             this.key = key;
121         }
122 
123         public void setValue(String val) {
124             this.value = val;
125         }
126     }
127 }