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.common.utils.StringUtils.*;
020import static org.apache.juneau.xml.annotation.XmlFormat.*;
021
022import java.net.*;
023
024import org.apache.juneau.*;
025import org.apache.juneau.annotation.*;
026import org.apache.juneau.xml.annotation.*;
027
028/**
029 * Represents a larger logo image for visual identification of a feed.
030 *
031 * <p>
032 * The logo element contains a URI reference to an image that provides visual identification 
033 * for the feed. Logos are typically larger than icons and are suitable for display in feed 
034 * readers, aggregators, and feed directories.
035 *
036 * <p>
037 * Per RFC 4287 recommendations:
038 * <ul class='spaced-list'>
039 *    <li>Should have a 2:1 aspect ratio (twice as wide as tall)
040 *    <li>Common formats: PNG, JPEG, GIF, SVG
041 *    <li>Suitable for prominent display in feed readers
042 * </ul>
043 *
044 * <h5 class='figure'>Schema</h5>
045 * <p class='bschema'>
046 *    atomLogo = element atom:logo {
047 *       atomCommonAttributes,
048 *       (atomUri)
049 *    }
050 * </p>
051 *
052 * <h5 class='section'>Example:</h5>
053 * <p class='bjava'>
054 *    Logo <jv>logo</jv> = <jk>new</jk> Logo(<js>"http://example.org/logo.png"</js>);
055 *
056 *    Feed <jv>feed</jv> = <jk>new</jk> Feed(...)
057 *       .setLogo(<jv>logo</jv>);
058 * </p>
059 *
060 * <h5 class='section'>Specification:</h5>
061 * <p>
062 * Represents an <c>atomLogo</c> construct in the 
063 * <a class="doclink" href="https://tools.ietf.org/html/rfc4287#section-4.2.8">RFC 4287 - Section 4.2.8</a> specification.
064 *
065 * <h5 class='section'>See Also:</h5><ul>
066 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanAtom">juneau-bean-atom</a>
067 *    <li class='extlink'><a class="doclink" href="https://tools.ietf.org/html/rfc4287">RFC 4287 - The Atom Syndication Format</a>
068 * </ul>
069 */
070@Bean(typeName="logo")
071public class Logo extends Common {
072
073   private URI uri;
074
075
076   /**
077    * Normal constructor.
078    *
079    * <p>
080    * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}.
081    * <br>Strings must be valid URIs.
082    *
083    * <p>
084    * URIs defined by {@link UriResolver} can be used for values.
085    *
086    * @param uri The URI of the logo.
087    */
088   public Logo(Object uri) {
089      setUri(uri);
090   }
091
092   /** Bean constructor. */
093   public Logo() {}
094
095
096   //-----------------------------------------------------------------------------------------------------------------
097   // Bean properties
098   //-----------------------------------------------------------------------------------------------------------------
099
100   /**
101    * Bean property getter:  <property>uri</property>.
102    *
103    * <p>
104    * The URI of the logo.
105    *
106    * @return The property value, or <jk>null</jk> if it is not set.
107    */
108   @Xml(format=TEXT)
109   public URI getUri() {
110      return uri;
111   }
112
113   /**
114    * Bean property setter:  <property>uri</property>.
115    *
116    * <p>
117    * The URI of the logo.
118    *
119    * <p>
120    * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}.
121    * <br>Strings must be valid URIs.
122    *
123    * <p>
124    * URIs defined by {@link UriResolver} can be used for values.
125    *
126    * @param value
127    *    The new value for this property.
128    *    <br>Can be <jk>null</jk> to unset the property.
129    * @return This object
130    */
131   public Logo setUri(Object value) {
132      this.uri = toURI(value);
133      return this;
134   }
135
136   //-----------------------------------------------------------------------------------------------------------------
137   // Overridden setters (to simplify method chaining)
138   //-----------------------------------------------------------------------------------------------------------------
139
140   @Override /* Overridden from Common */
141   public Logo setBase(Object value) {
142      super.setBase(value);
143      return this;
144   }
145
146   @Override /* Overridden from Common */
147   public Logo setLang(String value) {
148      super.setLang(value);
149      return this;
150   }
151}