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 HTML5.text-level-semantics#the-a-element <a>}
023 * element.
024 *
025 * <ul class='seealso'>
026 *    <li class='link'>{@doc juneau-dto.HTML5}
027 * </ul>
028 */
029@Bean(typeName="a")
030public class A extends HtmlElementMixed {
031
032   /**
033    * {@doc HTML5.links#attr-hyperlink-download download} attribute.
034    *
035    * <p>
036    * Whether to download the resource instead of navigating to it, and its file name if so.
037    *
038    * @param download
039    *    The new value for this attribute.
040    *    Typically a {@link Boolean} or {@link String}.
041    * @return This object (for method chaining).
042    */
043   public final A download(Object download) {
044      attr("download", download);
045      return this;
046   }
047
048   /**
049    * {@doc HTML5.links#attr-hyperlink-href href} attribute.
050    *
051    * <p>
052    * Address of the hyperlink.
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 href
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 A href(Object href) {
067      attrUri("href", href);
068      return this;
069   }
070
071   /**
072    * {@doc HTML5.links#attr-hyperlink-hreflang hreflang} attribute.
073    *
074    * <p>
075    * Language of the linked resource.
076    *
077    * @param hreflang The new value for this attribute.
078    * @return This object (for method chaining).
079    */
080   public final A hreflang(String hreflang) {
081      attr("hreflang", hreflang);
082      return this;
083   }
084
085   /**
086    * {@doc HTML5.links#attr-hyperlink-rel rel} attribute.
087    *
088    * <p>
089    * Relationship between the document containing the hyperlink and the destination resource.
090    *
091    * @param rel The new value for this attribute.
092    * @return This object (for method chaining).
093    */
094   public final A rel(String rel) {
095      attr("rel", rel);
096      return this;
097   }
098
099   /**
100    * {@doc HTML5.links#attr-hyperlink-target target} attribute.
101    *
102    * <p>
103    * Default browsing context for hyperlink navigation and form submission.
104    *
105    * @param target The new value for this attribute.
106    * @return This object (for method chaining).
107    */
108   public final A target(String target) {
109      attr("target", target);
110      return this;
111   }
112
113   /**
114    * {@doc HTML5.links#attr-hyperlink-type type} attribute.
115    *
116    * <p>
117    * Hint for the type of the referenced resource.
118    *
119    * @param type The new value for this attribute.
120    * @return This object (for method chaining).
121    */
122   public final A type(String type) {
123      attr("type", type);
124      return this;
125   }
126
127
128   //-----------------------------------------------------------------------------------------------------------------
129   // Overridden methods
130   //-----------------------------------------------------------------------------------------------------------------
131
132   @Override /* HtmlElement */
133   public final A _class(String _class) {
134      super._class(_class);
135      return this;
136   }
137
138   @Override /* HtmlElement */
139   public final A id(String id) {
140      super.id(id);
141      return this;
142   }
143
144   @Override /* HtmlElement */
145   public final A style(String style) {
146      super.style(style);
147      return this;
148   }
149
150   @Override /* HtmlElementMixed */
151   public A children(Object...children) {
152      super.children(children);
153      return this;
154   }
155
156   @Override /* HtmlElementMixed */
157   public A child(Object child) {
158      super.child(child);
159      return this;
160   }
161}