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.document-metadata#the-link-element <link>} 023 * element. 024 * 025 * <ul class='seealso'> 026 * <li class='link'>{@doc juneau-dto.HTML5} 027 * </ul> 028 */ 029@Bean(typeName="link") 030public class Link extends HtmlElementVoid { 031 032 /** 033 * {@doc HTML5.document-metadata#attr-link-crossorigin crossorigin} 034 * attribute. 035 * 036 * <p> 037 * How the element handles cross-origin requests. 038 * 039 * @param crossorigin The new value for this attribute. 040 * @return This object (for method chaining). 041 */ 042 public final Link crossorigin(String crossorigin) { 043 attr("crossorigin", crossorigin); 044 return this; 045 } 046 047 /** 048 * {@doc HTML5.document-metadata#attr-link-href href} attribute. 049 * 050 * <p> 051 * Address of the hyperlink. 052 * 053 * <p> 054 * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}. 055 * Strings must be valid URIs. 056 * 057 * <p> 058 * URIs defined by {@link UriResolver} can be used for values. 059 * 060 * @param href 061 * The new value for this attribute. 062 * Typically a {@link URL} or {@link String}. 063 * @return This object (for method chaining). 064 */ 065 public final Link href(Object href) { 066 attrUri("href", href); 067 return this; 068 } 069 070 /** 071 * {@doc HTML5.document-metadata#attr-link-hreflang hreflang} 072 * 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 Link hreflang(String hreflang) { 081 attr("hreflang", hreflang); 082 return this; 083 } 084 085 /** 086 * {@doc HTML5.document-metadata#attr-link-media media} attribute. 087 * 088 * <p> 089 * Applicable media. 090 * 091 * @param media The new value for this attribute. 092 * @return This object (for method chaining). 093 */ 094 public final Link media(String media) { 095 attr("media", media); 096 return this; 097 } 098 099 /** 100 * {@doc HTML5.document-metadata#attr-link-rel rel} attribute. 101 * 102 * <p> 103 * Relationship between the document containing the hyperlink and the destination resource. 104 * 105 * @param rel The new value for this attribute. 106 * @return This object (for method chaining). 107 */ 108 public final Link rel(String rel) { 109 attr("rel", rel); 110 return this; 111 } 112 113 /** 114 * {@doc HTML5.links#attr-link-sizes sizes} attribute. 115 * 116 * <p> 117 * Sizes of the icons (for rel="icon"). 118 * 119 * @param sizes The new value for this attribute. 120 * @return This object (for method chaining). 121 */ 122 public final Link sizes(String sizes) { 123 attr("sizes", sizes); 124 return this; 125 } 126 127 /** 128 * {@doc HTML5.document-metadata#attr-link-type type} attribute. 129 * 130 * <p> 131 * Hint for the type of the referenced resource. 132 * 133 * @param type The new value for this attribute. 134 * @return This object (for method chaining). 135 */ 136 public final Link type(String type) { 137 attr("type", type); 138 return this; 139 } 140 141 142 //----------------------------------------------------------------------------------------------------------------- 143 // Overridden methods 144 //----------------------------------------------------------------------------------------------------------------- 145 146 @Override /* HtmlElement */ 147 public final Link _class(String _class) { 148 super._class(_class); 149 return this; 150 } 151 152 @Override /* HtmlElement */ 153 public final Link id(String id) { 154 super.id(id); 155 return this; 156 } 157 158 @Override /* HtmlElement */ 159 public final Link style(String style) { 160 super.style(style); 161 return this; 162 } 163}