View Javadoc

1   /*
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
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.ModelBuilder;
28  import org.kuali.student.contract.model.test.source.RichText;
29  import org.w3c.dom.Element;
30  
31  @XmlAccessorType(XmlAccessType.FIELD)
32  @XmlType(name = "RichTextInfo", propOrder = {"plain", "formatted", "_futureElements"})
33  public class RichTextInfo implements RichText, Serializable {
34  
35      private static final long serialVersionUID = 1L;
36  
37      @XmlElement
38      private final String plain;
39  
40      @XmlElement
41      private final String formatted;
42      
43      @XmlAnyElement
44      private final List<Element> _futureElements;    
45  
46      private RichTextInfo() {
47      	plain = null;
48      	formatted = null;
49      	_futureElements=null;
50      }
51      
52      private RichTextInfo(RichText builder) {
53      	this.plain = builder.getPlain();
54      	this.formatted = builder.getFormatted();
55      	this._futureElements=null;
56      }
57      
58      @Override
59      public String getPlain() {
60          return plain;
61      }
62  
63      @Override
64      public String getFormatted() {
65          return formatted;
66      }
67  
68      @Override
69      public String toString() {
70      	return "RichTextInfo[plain=" + plain + ", formatted=" + formatted + "]";
71      }
72      
73      public static class Builder implements ModelBuilder<RichTextInfo>, RichText {
74      	private String plain;
75  		private String formatted;
76  
77  		public Builder() {}
78      	
79      	public Builder(RichText rtInfo) {
80      		this.plain = rtInfo.getPlain();
81      		this.formatted = rtInfo.getFormatted();
82      	}
83      	
84      	public RichTextInfo build() {
85      		return new RichTextInfo(this);
86      	}
87  
88          public String getPlain() {
89              return plain;
90          }
91  
92          public void setPlain(String plain) {
93              this.plain = plain;
94          }
95  
96          public String getFormatted() {
97              return formatted;
98          }
99  
100         public void setFormatted(String formatted) {
101             this.formatted = formatted;
102         }
103     }
104 }