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      super();
087   }
088
089
090   //-----------------------------------------------------------------------------------------------------------------
091   // Bean properties
092   //-----------------------------------------------------------------------------------------------------------------
093
094   /**
095    * Bean property getter:  <property>src</property>.
096    *
097    * <p>
098    * The source URI.
099    *
100    * @return The property value, or <jk>null</jk> if it is not set.
101    */
102   @Xml(format=ATTR)
103   public URI getSrc() {
104      return src;
105   }
106
107   /**
108    * Bean property setter:  <property>src</property>.
109    *
110    * <p>
111    * The source URI.
112    *
113    * <p>
114    * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}.
115    * Strings must be valid URIs.
116    *
117    * @param value
118    *    The new value for this property.
119    *    <br>Can be <jk>null</jk> to unset the property.
120    * @return This object
121    */
122   public Content setSrc(Object value) {
123      this.src = toURI(value);
124      return this;
125   }
126
127
128   //-----------------------------------------------------------------------------------------------------------------
129   // Overridden setters (to simplify method chaining)
130   //-----------------------------------------------------------------------------------------------------------------
131
132   @Override /* Text */
133   public Content setText(String text) {
134      super.setText(text);
135      return this;
136   }
137
138   @Override /* Text */
139   public Content setType(String type) {
140      super.setType(type);
141      return this;
142   }
143
144   // <FluentSetters>
145
146   @Override /* GENERATED - org.apache.juneau.dto.atom.Common */
147   public Content setBase(Object value) {
148      super.setBase(value);
149      return this;
150   }
151
152   @Override /* GENERATED - org.apache.juneau.dto.atom.Common */
153   public Content setLang(String value) {
154      super.setLang(value);
155      return this;
156   }
157
158   // </FluentSetters>
159}