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