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.html5;
014
015import java.net.*;
016import java.net.URI;
017
018import org.apache.juneau.*;
019import org.apache.juneau.annotation.*;
020
021/**
022 * DTO for an HTML {@doc ExtHTML5.embedded-content-0#the-source-element <source>}
023 * element.
024 *
025 * <ul class='seealso'>
026 *    <li class='link'>{@doc DtoHtml5}
027 * </ul>
028 */
029@Bean(typeName="source")
030public class Source extends HtmlElementVoid {
031
032   /**
033    * Creates an empty {@link Source} element.
034    */
035   public Source() {}
036
037   /**
038    * Creates a {@link Source} element with the specified {@link Source#src(Object)} and {@link Source#type(String)}
039    * attributes.
040    *
041    * @param src The {@link Source#src(Object)} attribute.
042    * @param type The {@link Source#type(String)} attribute.
043    */
044   public Source(Object src, String type) {
045      src(src).type(type);
046   }
047
048   /**
049    * {@doc ExtHTML5.embedded-content-0#attr-source-src src} attribute.
050    *
051    * <p>
052    * Address of the resource.
053    *
054    * <p>
055    * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}.
056    * Strings must be valid URIs.
057    *
058    * <p>
059    * URIs defined by {@link UriResolver} can be used for values.
060    *
061    * @param src
062    *    The new value for this attribute.
063    *    Typically a {@link URL} or {@link String}.
064    * @return This object (for method chaining).
065    */
066   public final Source src(Object src) {
067      attrUri("src", src);
068      return this;
069   }
070
071   /**
072    * {@doc ExtHTML5.embedded-content-0#attr-source-type type} attribute.
073    *
074    * <p>
075    * Type of embedded resource.
076    *
077    * @param type The new value for this attribute.
078    * @return This object (for method chaining).
079    */
080   public final Source type(String type) {
081      attr("type", type);
082      return this;
083   }
084
085
086   //-----------------------------------------------------------------------------------------------------------------
087   // Overridden methods
088   //-----------------------------------------------------------------------------------------------------------------
089
090   @Override /* HtmlElement */
091   public final Source _class(String _class) {
092      super._class(_class);
093      return this;
094   }
095
096   @Override /* HtmlElement */
097   public final Source id(String id) {
098      super.id(id);
099      return this;
100   }
101}