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.common.internal.StringUtils.*;
016import static org.apache.juneau.xml.annotation.XmlFormat.*;
017
018import java.net.*;
019
020import org.apache.juneau.annotation.*;
021import org.apache.juneau.internal.*;
022import org.apache.juneau.xml.annotation.*;
023
024/**
025 * Represents an <c>atomGenerator</c> construct in the RFC4287 specification.
026 *
027 * <h5 class='figure'>Schema</h5>
028 * <p class='bschema'>
029 *    atomGenerator = element atom:generator {
030 *       atomCommonAttributes,
031 *       attribute uri { atomUri }?,
032 *       attribute version { text }?,
033 *       text
034 *    }
035 * </p>
036 *
037 * <h5 class='section'>See Also:</h5><ul>
038 *    <li class='link'><a class="doclink" href="../../../../../index.html#jd.Atom">Overview &gt; juneau-dto &gt; Atom</a>
039 * </ul>
040 */
041@Bean(typeName="generator")
042@FluentSetters
043public class Generator extends Common {
044
045   private URI uri;
046   private String version;
047   private String text;
048
049
050   /**
051    * Normal constructor.
052    *
053    * @param text The generator statement content.
054    */
055   public Generator(String text) {
056      this.text = text;
057   }
058
059   /** Bean constructor. */
060   public Generator() {}
061
062
063   //-----------------------------------------------------------------------------------------------------------------
064   // Bean properties
065   //-----------------------------------------------------------------------------------------------------------------
066
067   /**
068    * Bean property getter:  <property>uri</property>.
069    *
070    * <p>
071    * The URI of this generator statement.
072    *
073    * @return The property value, or <jk>null</jk> if it is not set.
074    */
075   @Xml(format=ATTR)
076   public URI getUri() {
077      return uri;
078   }
079
080   /**
081    * Bean property setter:  <property>uri</property>.
082    *
083    * <p>
084    * The URI of this generator statement.
085    *
086    * <p>
087    * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}.
088    * Strings must be valid URIs.
089    *
090    * @param value
091    *    The new value for this property.
092    *    <br>Can be <jk>null</jk> to unset the property.
093    * @return This object
094    */
095   public Generator setUri(Object value) {
096      this.uri = toURI(value);
097      return this;
098   }
099
100   /**
101    * Bean property getter:  <property>version</property>.
102    *
103    * <p>
104    * The version of this generator statement.
105    *
106    * @return The property value, or <jk>null</jk> if it is not set.
107    */
108   @Xml(format=ATTR)
109   public String getVersion() {
110      return version;
111   }
112
113   /**
114    * Bean property setter:  <property>version</property>.
115    *
116    * <p>
117    * The version of this generator statement.
118    *
119    * @param value
120    *    The new value for this property.
121    *    <br>Can be <jk>null</jk> to unset the property.
122    * @return This object
123    */
124   public Generator setVersion(String value) {
125      this.version = value;
126      return this;
127   }
128
129   /**
130    * Bean property getter:  <property>text</property>.
131    *
132    * <p>
133    * The content of this generator statement.
134    *
135    * @return The property value, or <jk>null</jk> if it is not set.
136    */
137   @Xml(format=TEXT)
138   public String getText() {
139      return text;
140   }
141
142   /**
143    * Bean property setter:  <property>text</property>.
144    *
145    * <p>
146    * The content of this generator statement.
147    *
148    * @param value
149    *    The new value for this property.
150    *    <br>Can be <jk>null</jk> to unset the property.
151    * @return This object
152    */
153   public Generator setText(String value) {
154      this.text = value;
155      return this;
156   }
157
158   //-----------------------------------------------------------------------------------------------------------------
159   // Overridden setters (to simplify method chaining)
160   //-----------------------------------------------------------------------------------------------------------------
161
162   // <FluentSetters>
163
164   @Override /* GENERATED - org.apache.juneau.dto.atom.Common */
165   public Generator setBase(Object value) {
166      super.setBase(value);
167      return this;
168   }
169
170   @Override /* GENERATED - org.apache.juneau.dto.atom.Common */
171   public Generator setLang(String value) {
172      super.setLang(value);
173      return this;
174   }
175
176   // </FluentSetters>
177}