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.internal.*;
021import org.apache.juneau.xml.*;
022import org.apache.juneau.xml.annotation.*;
023
024/**
025 * Represents an <c>atomCommonAttributes</c> construct in the RFC4287 specification.
026 *
027 * <h5 class='figure'>Schema</h5>
028 * <p class='bschema'>
029 *    atomCommonAttributes =
030 *       attribute xml:base { atomUri }?,
031 *       attribute xml:lang { atomLanguageTag }?,
032 *       undefinedAttribute*
033 * </p>
034 *
035 * <h5 class='section'>See Also:</h5><ul>
036 *    <li class='link'><a class="doclink" href="../../../../../index.html#jd.Atom">Overview &gt; juneau-dto &gt; Atom</a>
037 * </ul>
038 */
039@FluentSetters
040public abstract class Common {
041
042   private URI base;
043   private String lang;
044
045
046   //-----------------------------------------------------------------------------------------------------------------
047   // Bean properties
048   //-----------------------------------------------------------------------------------------------------------------
049
050   /**
051    * Bean property getter:  <property>base</property>.
052    *
053    * <p>
054    * The URI base of this object.
055    *
056    * @return The property value, or <jk>null</jk> if it is not set.
057    */
058   @Xml(prefix="xml", format=ATTR)
059   public URI getBase() {
060      return base;
061   }
062
063   /**
064    * Bean property setter:  <property>term</property>.
065    *
066    * <p>
067    * The URI base of this object.
068    *
069    * <p>
070    * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}.
071    * Strings must be valid URIs.
072    *
073    * @param value
074    *    The new value for this property.
075    *    <br>Can be <jk>null</jk> to unset the property.
076    * @return This object
077    */
078   @FluentSetter
079   public Common setBase(Object value) {
080      this.base = toURI(value);
081      return this;
082   }
083
084   /**
085    * Bean property getter:  <property>lang</property>.
086    *
087    * <p>
088    * The language of this object.
089    *
090    * @return The property value, or <jk>null</jk> if it is not set.
091    */
092   @Xml(prefix="xml", format=ATTR)
093   public String getLang() {
094      return lang;
095   }
096
097   /**
098    * Bean property setter:  <property>lang</property>.
099    *
100    * <p>
101    * The language of this object.
102    *
103    * @param value
104    *    The new value for this property.
105    *    <br>Can be <jk>null</jk> to unset the property.
106    * @return This object
107    */
108   @FluentSetter
109   public Common setLang(String value) {
110      this.lang = value;
111      return this;
112   }
113
114   // <FluentSetters>
115
116   // </FluentSetters>
117
118   @Override /* Object */
119   public String toString() {
120      return XmlSerializer.DEFAULT_SQ.toString(this);
121   }
122}