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