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.internal.StringUtils.*; 016import static org.apache.juneau.xml.annotation.XmlFormat.*; 017 018import java.net.*; 019import java.net.URI; 020 021import org.apache.juneau.*; 022import org.apache.juneau.annotation.*; 023import org.apache.juneau.xml.annotation.*; 024 025/** 026 * Represents an <c>atomIcon</c> construct in the RFC4287 specification. 027 * 028 * <h5 class='figure'>Schema</h5> 029 * <p class='bcode w800'> 030 * atomIcon = element atom:icon { 031 * atomCommonAttributes, 032 * (atomUri) 033 * } 034 * </p> 035 * 036 * <ul class='seealso'> 037 * <li class='link'>{@doc DtoAtom} 038 * <li class='jp'>{@doc package-summary.html#TOC} 039 * </ul> 040 */ 041@Bean(typeName="icon") 042public class Icon extends Common { 043 044 private URI uri; 045 046 047 /** 048 * Normal constructor. 049 * 050 * <p> 051 * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}. 052 * Strings must be valid URIs. 053 * 054 * <p> 055 * URIs defined by {@link UriResolver} can be used for values. 056 * 057 * @param uri The URI of the icon. 058 */ 059 public Icon(Object uri) { 060 uri(uri); 061 } 062 063 /** Bean constructor. */ 064 public Icon() {} 065 066 067 //----------------------------------------------------------------------------------------------------------------- 068 // Bean properties 069 //----------------------------------------------------------------------------------------------------------------- 070 071 /** 072 * Returns the URI of this icon. 073 * 074 * @return The URI of this icon. 075 */ 076 @Xml(format=ELEMENTS) 077 public URI getUri() { 078 return uri; 079 } 080 081 /** 082 * Sets the URI of this icon. 083 * 084 * <p> 085 * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}. 086 * Strings must be valid URIs. 087 * 088 * <p> 089 * URIs defined by {@link UriResolver} can be used for values. 090 * 091 * @param uri The URI of this icon. 092 * @return This object (for method chaining). 093 */ 094 @Beanp("uri") 095 public Icon uri(Object uri) { 096 this.uri = toURI(uri); 097 return this; 098 } 099 100 101 //----------------------------------------------------------------------------------------------------------------- 102 // Overridden setters (to simplify method chaining) 103 //----------------------------------------------------------------------------------------------------------------- 104 105 @Override /* Common */ 106 public Icon base(Object base) { 107 super.base(base); 108 return this; 109 } 110 111 @Override /* Common */ 112 public Icon lang(String lang) { 113 super.lang(lang); 114 return this; 115 } 116}