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.atom; 014 015import static org.apache.juneau.xml.annotation.XmlFormat.*; 016 017import org.apache.juneau.annotation.*; 018import org.apache.juneau.internal.*; 019import org.apache.juneau.xml.annotation.*; 020 021/** 022 * Represents an <c>atomLink</c> construct in the RFC4287 specification. 023 * 024 * <h5 class='figure'>Schema</h5> 025 * <p class='bschema'> 026 * atomLink = 027 * element atom:link { 028 * atomCommonAttributes, 029 * attribute href { atomUri }, 030 * attribute rel { atomNCName | atomUri }?, 031 * attribute type { atomMediaType }?, 032 * attribute hreflang { atomLanguageTag }?, 033 * attribute title { text }?, 034 * attribute length { text }?, 035 * undefinedContent 036 * } 037 * </p> 038 * 039 * <h5 class='section'>See Also:</h5><ul> 040 * <li class='link'><a class="doclink" href="../../../../../index.html#jd.Atom">Overview > juneau-dto > Atom</a> 041 * </ul> 042 */ 043@Bean(typeName="link") 044@FluentSetters 045public class Link extends Common { 046 047 private String href; 048 private String rel; 049 private String type; 050 private String hreflang; 051 private String title; 052 private Integer length; 053 054 055 /** 056 * Normal constructor. 057 * 058 * @param rel The rel of the link. 059 * @param type The type of the link. 060 * @param href The URI of the link. 061 */ 062 public Link(String rel, String type, String href) { 063 setRel(rel).setType(type).setHref(href); 064 } 065 066 /** Bean constructor. */ 067 public Link() {} 068 069 070 //----------------------------------------------------------------------------------------------------------------- 071 // Bean properties 072 //----------------------------------------------------------------------------------------------------------------- 073 074 /** 075 * Bean property getter: <property>href</property>. 076 * 077 * <p> 078 * The href of the target of this link. 079 * 080 * @return The property value, or <jk>null</jk> if it is not set. 081 */ 082 @Xml(format=ATTR) 083 public String getHref() { 084 return href; 085 } 086 087 /** 088 * Bean property setter: <property>href</property>. 089 * 090 * <p> 091 * The href of the target of this link. 092 * 093 * @param value 094 * The new value for this property. 095 * <br>Can be <jk>null</jk> to unset the property. 096 * @return This object 097 */ 098 public Link setHref(String value) { 099 this.href = value; 100 return this; 101 } 102 103 /** 104 * Bean property getter: <property>rel</property>. 105 * 106 * <p> 107 * The rel of this link. 108 * 109 * @return The property value, or <jk>null</jk> if it is not set. 110 */ 111 @Xml(format=ATTR) 112 public String getRel() { 113 return rel; 114 } 115 116 /** 117 * Bean property setter: <property>rel</property>. 118 * 119 * <p> 120 * The rel of this link. 121 * 122 * @param value 123 * The new value for this property. 124 * <br>Can be <jk>null</jk> to unset the property. 125 * @return This object 126 */ 127 public Link setRel(String value) { 128 this.rel = value; 129 return this; 130 } 131 132 /** 133 * Bean property getter: <property>type</property>. 134 * 135 * <p> 136 * The content type of the target of this link. 137 * 138 * @return The property value, or <jk>null</jk> if it is not set. 139 */ 140 @Xml(format=ATTR) 141 public String getType() { 142 return type; 143 } 144 145 /** 146 * Bean property setter: <property>type</property>. 147 * 148 * <p> 149 * The content type of the target of this link. 150 * 151 * <p> 152 * Must be one of the following: 153 * <ul> 154 * <li><js>"text"</js> 155 * <li><js>"html"</js> 156 * <li><js>"xhtml"</js> 157 * <li><jk>null</jk> (defaults to <js>"text"</js>) 158 * </ul> 159 * 160 * @param value 161 * The new value for this property. 162 * <br>Can be <jk>null</jk> to unset the property. 163 * @return This object 164 */ 165 public Link setType(String value) { 166 this.type = value; 167 return this; 168 } 169 170 /** 171 * Bean property getter: <property>hreflang</property>. 172 * 173 * <p> 174 * The language of the target of this link. 175 * 176 * @return The property value, or <jk>null</jk> if it is not set. 177 */ 178 @Xml(format=ATTR) 179 public String getHreflang() { 180 return hreflang; 181 } 182 183 /** 184 * Bean property setter: <property>hreflang</property>. 185 * 186 * <p> 187 * The language of the target of this link. 188 * 189 * @param value 190 * The new value for this property. 191 * <br>Can be <jk>null</jk> to unset the property. 192 * @return This object 193 */ 194 public Link setHreflang(String value) { 195 this.hreflang = value; 196 return this; 197 } 198 199 /** 200 * Bean property getter: <property>title</property>. 201 * 202 * <p> 203 * The title of the target of this link. 204 * 205 * @return The property value, or <jk>null</jk> if it is not set. 206 */ 207 @Xml(format=ATTR) 208 public String getTitle() { 209 return title; 210 } 211 212 /** 213 * Bean property setter: <property>title</property>. 214 * 215 * <p> 216 * The title of the target of this link. 217 * 218 * @param value 219 * The new value for this property. 220 * <br>Can be <jk>null</jk> to unset the property. 221 * @return This object 222 */ 223 public Link setTitle(String value) { 224 this.title = value; 225 return this; 226 } 227 228 /** 229 * Bean property getter: <property>length</property>. 230 * 231 * <p> 232 * The length of the contents of the target of this link. 233 * 234 * @return The property value, or <jk>null</jk> if it is not set. 235 */ 236 @Xml(format=ATTR) 237 public Integer getLength() { 238 return length; 239 } 240 241 /** 242 * Bean property setter: <property>length</property>. 243 * 244 * <p> 245 * The length of the contents of the target of this link. 246 * 247 * @param value 248 * The new value for this property. 249 * <br>Can be <jk>null</jk> to unset the property. 250 * @return This object 251 */ 252 public Link setLength(Integer value) { 253 this.length = value; 254 return this; 255 } 256 257 //----------------------------------------------------------------------------------------------------------------- 258 // Overridden setters (to simplify method chaining) 259 //----------------------------------------------------------------------------------------------------------------- 260 261 // <FluentSetters> 262 263 @Override /* GENERATED - org.apache.juneau.dto.atom.Common */ 264 public Link setBase(Object value) { 265 super.setBase(value); 266 return this; 267 } 268 269 @Override /* GENERATED - org.apache.juneau.dto.atom.Common */ 270 public Link setLang(String value) { 271 super.setLang(value); 272 return this; 273 } 274 275 // </FluentSetters> 276}