001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.dto.atom;
014
015import static org.apache.juneau.xml.annotation.XmlFormat.*;
016
017import org.apache.juneau.internal.*;
018import org.apache.juneau.xml.annotation.*;
019
020/**
021 * Represents an <c>atomTextConstruct</c> construct in the RFC4287 specification.
022 *
023 * <h5 class='figure'>Schema</h5>
024 * <p class='bschema'>
025 *    atomTextConstruct = atomPlainTextConstruct | atomXHTMLTextConstruct
026 *
027 *    atomPlainTextConstruct =
028 *       atomCommonAttributes,
029 *       attribute type { "text" | "html" }?,
030 *       text
031 *
032 *    atomXHTMLTextConstruct =
033 *       atomCommonAttributes,
034 *       attribute type { "xhtml" },
035 *       xhtmlDiv
036 *
037 *    xhtmlDiv = element xhtml:div {
038 *       (attribute * { text }
039 *       | text
040 *       | anyXHTML)*
041 *    }
042 * </p>
043 *
044 * <h5 class='section'>See Also:</h5><ul>
045 *    <li class='link'><a class="doclink" href="../../../../../index.html#jd.Atom">Overview &gt; juneau-dto &gt; Atom</a>
046 * </ul>
047 */
048@FluentSetters
049public class Text extends Common {
050
051   private String type;
052   private String text;
053
054   /**
055    * Normal content.
056    *
057    * @param type The content type of this content.
058    */
059   public Text(String type) {
060      setType(type);
061   }
062
063   /** Bean constructor. */
064   public Text() {}
065
066
067   //-----------------------------------------------------------------------------------------------------------------
068   // Bean properties
069   //-----------------------------------------------------------------------------------------------------------------
070
071   /**
072    * Bean property getter:  <property>type</property>.
073    *
074    * <p>
075    * The content type of this content.
076    *
077    * @return The property value, or <jk>null</jk> if it is not set.
078    */
079   @Xml(format=ATTR)
080   public String getType() {
081      return type;
082   }
083
084   /**
085    * Bean property setter:  <property>type</property>.
086    *
087    * <p>
088    * The content type of this content.
089    *
090    * <p>
091    * Must be one of the following:
092    * <ul>
093    *    <li><js>"text"</js>
094    *    <li><js>"html"</js>
095    *    <li><js>"xhtml"</js>
096    *    <li><jk>null</jk> (defaults to <js>"text"</js>)
097    * </ul>
098    *
099    * @param value
100    *    The new value for this property.
101    *    <br>Can be <jk>null</jk> to unset the property.
102    * @return This object
103    */
104   public Text setType(String value) {
105      this.type = value;
106      return this;
107   }
108
109   /**
110    * Bean property getter:  <property>text</property>.
111    *
112    * <p>
113    * The content of this content.
114    *
115    * @return The property value, or <jk>null</jk> if it is not set.
116    */
117   @Xml(format=XMLTEXT)
118   public String getText() {
119      return text;
120   }
121
122   /**
123    * Bean property setter:  <property>text</property>.
124    *
125    * <p>
126    * The content of this content.
127    *
128    * @param value
129    *    The new value for this property.
130    *    <br>Can be <jk>null</jk> to unset the property.
131    * @return This object
132    */
133   public Text setText(String value) {
134      this.text = value;
135      return this;
136   }
137
138
139   //-----------------------------------------------------------------------------------------------------------------
140   // Overridden setters (to simplify method chaining)
141   //-----------------------------------------------------------------------------------------------------------------
142
143   // <FluentSetters>
144
145   @Override /* GENERATED - org.apache.juneau.dto.atom.Common */
146   public Text setBase(Object value) {
147      super.setBase(value);
148      return this;
149   }
150
151   @Override /* GENERATED - org.apache.juneau.dto.atom.Common */
152   public Text setLang(String value) {
153      super.setLang(value);
154      return this;
155   }
156
157   // </FluentSetters>
158}