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