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/document-metadata.html#the-link-element"><link></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="link") 031public class Link extends HtmlElementVoid { 032 033 /** 034 * <a class="doclink" href="https://www.w3.org/TR/html5/document-metadata.html#attr-link-crossorigin">crossorigin</a> 035 * attribute. 036 * 037 * <p> 038 * How the element handles cross-origin requests. 039 * 040 * @param crossorigin The new value for this attribute. 041 * @return This object (for method chaining). 042 */ 043 public final Link crossorigin(String crossorigin) { 044 attr("crossorigin", crossorigin); 045 return this; 046 } 047 048 /** 049 * <a class="doclink" href="https://www.w3.org/TR/html5/document-metadata.html#attr-link-href">href</a> 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 Link href(Object href) { 067 attrUri("href", href); 068 return this; 069 } 070 071 /** 072 * <a class="doclink" href="https://www.w3.org/TR/html5/document-metadata.html#attr-link-hreflang">hreflang</a> 073 * 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 Link hreflang(String hreflang) { 082 attr("hreflang", hreflang); 083 return this; 084 } 085 086 /** 087 * <a class="doclink" href="https://www.w3.org/TR/html5/document-metadata.html#attr-link-media">media</a> attribute. 088 * 089 * <p> 090 * Applicable media. 091 * 092 * @param media The new value for this attribute. 093 * @return This object (for method chaining). 094 */ 095 public final Link media(String media) { 096 attr("media", media); 097 return this; 098 } 099 100 /** 101 * <a class="doclink" href="https://www.w3.org/TR/html5/document-metadata.html#attr-link-rel">rel</a> attribute. 102 * 103 * <p> 104 * Relationship between the document containing the hyperlink and the destination resource. 105 * 106 * @param rel The new value for this attribute. 107 * @return This object (for method chaining). 108 */ 109 public final Link rel(String rel) { 110 attr("rel", rel); 111 return this; 112 } 113 114 /** 115 * <a class="doclink" href="https://www.w3.org/TR/html5/links.html#attr-link-sizes">sizes</a> attribute. 116 * 117 * <p> 118 * Sizes of the icons (for rel="icon"). 119 * 120 * @param sizes The new value for this attribute. 121 * @return This object (for method chaining). 122 */ 123 public final Link sizes(String sizes) { 124 attr("sizes", sizes); 125 return this; 126 } 127 128 /** 129 * <a class="doclink" href="https://www.w3.org/TR/html5/document-metadata.html#attr-link-type">type</a> attribute. 130 * 131 * <p> 132 * Hint for the type of the referenced resource. 133 * 134 * @param type The new value for this attribute. 135 * @return This object (for method chaining). 136 */ 137 public final Link type(String type) { 138 attr("type", type); 139 return this; 140 } 141 142 143 //-------------------------------------------------------------------------------- 144 // Overridden methods 145 //-------------------------------------------------------------------------------- 146 147 @Override /* HtmlElement */ 148 public final Link _class(String _class) { 149 super._class(_class); 150 return this; 151 } 152 153 @Override /* HtmlElement */ 154 public final Link id(String id) { 155 super.id(id); 156 return this; 157 } 158 159 @Override /* HtmlElement */ 160 public final Link style(String style) { 161 super.style(style); 162 return this; 163 } 164}