001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.juneau.bean.atom; 018 019import static org.apache.juneau.commons.utils.StringUtils.*; 020import static org.apache.juneau.marshall.xml.XmlFormat.*; 021 022import java.net.*; 023 024import org.apache.juneau.marshall.*; 025import org.apache.juneau.marshall.xml.*; 026 027/** 028 * Represents a larger logo image for visual identification of a feed. 029 * 030 * <p> 031 * The logo element contains a URI reference to an image that provides visual identification 032 * for the feed. Logos are typically larger than icons and are suitable for display in feed 033 * readers, aggregators, and feed directories. 034 * 035 * <p> 036 * Per RFC 4287 recommendations: 037 * <ul class='spaced-list'> 038 * <li>Should have a 2:1 aspect ratio (twice as wide as tall) 039 * <li>Common formats: PNG, JPEG, GIF, SVG 040 * <li>Suitable for prominent display in feed readers 041 * </ul> 042 * 043 * <h5 class='figure'>Schema</h5> 044 * <p class='bschema'> 045 * atomLogo = element atom:logo { 046 * atomCommonAttributes, 047 * (atomUri) 048 * } 049 * </p> 050 * 051 * <h5 class='section'>Example:</h5> 052 * <p class='bjava'> 053 * Logo <jv>logo</jv> = <jk>new</jk> Logo(<js>"http://example.org/logo.png"</js>); 054 * 055 * Feed <jv>feed</jv> = <jk>new</jk> Feed(...) 056 * .setLogo(<jv>logo</jv>); 057 * </p> 058 * 059 * <h5 class='section'>Specification:</h5> 060 * <p> 061 * Represents an <c>atomLogo</c> construct in the 062 * <a class="doclink" href="https://tools.ietf.org/html/rfc4287#section-4.2.8">RFC 4287 - Section 4.2.8</a> specification. 063 * 064 * <h5 class='section'>See Also:</h5><ul> 065 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanAtom">juneau-bean-atom</a> 066 * <li class='extlink'><a class="doclink" href="https://tools.ietf.org/html/rfc4287">RFC 4287 - The Atom Syndication Format</a> 067 * </ul> 068 */ 069@Marshalled(typeName = "logo") 070public class Logo extends Common { 071 072 private URI uri; 073 074 /** Bean constructor. */ 075 public Logo() {} 076 077 /** 078 * Normal constructor. 079 * 080 * <p> 081 * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}. 082 * <br>Strings must be valid URIs. 083 * 084 * <p> 085 * URIs defined by {@link UriResolver} can be used for values. 086 * 087 * @param uri The URI of the logo. Can be <jk>null</jk> to leave the property unset. 088 */ 089 public Logo(Object uri) { 090 setUri(uri); 091 } 092 093 /** 094 * Bean property getter: <property>uri</property>. 095 * 096 * <p> 097 * The URI of the logo. 098 * 099 * @return The property value, or <jk>null</jk> if it is not set. 100 */ 101 @Xml(format = TEXT) 102 public URI getUri() { return uri; } 103 104 @Override /* Overridden from Common */ 105 public Logo setBase(Object value) { 106 super.setBase(value); 107 return this; 108 } 109 110 @Override /* Overridden from Common */ 111 public Logo setLang(String value) { 112 super.setLang(value); 113 return this; 114 } 115 116 /** 117 * Bean property setter: <property>uri</property>. 118 * 119 * <p> 120 * The URI of the logo. 121 * 122 * <p> 123 * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}. 124 * <br>Strings must be valid URIs. 125 * 126 * <p> 127 * URIs defined by {@link UriResolver} can be used for values. 128 * 129 * @param value 130 * The new value for this property. 131 * <br>Can be <jk>null</jk> to unset the property. 132 * @return This object 133 */ 134 public Logo setUri(Object value) { 135 this.uri = toUri(value); 136 return this; 137 } 138}