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 <code>atomGenerator</code> construct in the RFC4287 specification. 027 * 028 * <h5 class='figure'>Schema</h5> 029 * <p class='bcode'> 030 * atomGenerator = element atom:generator { 031 * atomCommonAttributes, 032 * attribute uri { atomUri }?, 033 * attribute version { text }?, 034 * text 035 * } 036 * </p> 037 * 038 * <h5 class='section'>See Also:</h5> 039 * <ul class='doctree'> 040 * <li class='link'><a class='doclink' href='../../../../../overview-summary.html#juneau-dto.Atom'>Overview > juneau-dto > Atom</a> 041 * <li class='jp'><a class='doclink' href='package-summary.html#TOC'>org.apache.juneau.dto.atom</a> 042 * </ul> 043 */ 044@Bean(typeName="generator") 045public class Generator extends Common { 046 047 private URI uri; 048 private String version; 049 private String text; 050 051 052 /** 053 * Normal constructor. 054 * 055 * @param text The generator statement content. 056 */ 057 public Generator(String text) { 058 this.text = text; 059 } 060 061 /** Bean constructor. */ 062 public Generator() {} 063 064 065 //-------------------------------------------------------------------------------- 066 // Bean properties 067 //-------------------------------------------------------------------------------- 068 069 /** 070 * Returns the URI of this generator statement. 071 * 072 * @return The URI of this generator statement. 073 */ 074 @Xml(format=ATTR) 075 public URI getUri() { 076 return uri; 077 } 078 079 /** 080 * Sets the URI of this generator statement. 081 * 082 * <p> 083 * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}. 084 * Strings must be valid URIs. 085 * 086 * <p> 087 * URIs defined by {@link UriResolver} can be used for values. 088 * 089 * @param uri The URI of this generator statement. 090 * @return This object (for method chaining). 091 */ 092 @BeanProperty("uri") 093 public Generator uri(Object uri) { 094 this.uri = toURI(uri); 095 return this; 096 } 097 098 /** 099 * Returns the version of this generator statement. 100 * 101 * @return The version of this generator statement. 102 */ 103 @Xml(format=ATTR) 104 public String getVersion() { 105 return version; 106 } 107 108 /** 109 * Sets the version of this generator statement. 110 * 111 * @param version The version of this generator statement. 112 * @return This object (for method chaining). 113 */ 114 @BeanProperty("version") 115 public Generator version(String version) { 116 this.version = version; 117 return this; 118 } 119 120 /** 121 * Returns the content of this generator statement. 122 * 123 * @return The content of this generator statement. 124 */ 125 @Xml(format=TEXT) 126 public String getText() { 127 return text; 128 } 129 130 /** 131 * Sets the content of this generator statement. 132 * 133 * @param text The content of this generator statement. 134 * @return This object (for method chaining). 135 */ 136 @BeanProperty("text") 137 public Generator text(String text) { 138 this.text = text; 139 return this; 140 } 141 142 143 //-------------------------------------------------------------------------------- 144 // Overridden setters (to simplify method chaining) 145 //-------------------------------------------------------------------------------- 146 147 @Override /* Common */ 148 public Generator base(Object base) { 149 super.base(base); 150 return this; 151 } 152 153 @Override /* Common */ 154 public Generator lang(String lang) { 155 super.lang(lang); 156 return this; 157 } 158}