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.common.internal.StringUtils.*;
016
017import java.net.*;
018
019import org.apache.juneau.*;
020import org.apache.juneau.internal.*;
021
022/**
023 * Represents an <c>atomPersonConstruct</c> construct in the RFC4287 specification.
024 *
025 * <h5 class='figure'>Schema</h5>
026 * <p class='bschema'>
027 *    atomPersonConstruct =
028 *       atomCommonAttributes,
029 *       (element atom:name { text }
030 *       &amp; element atom:uri { atomUri }?
031 *       &amp; element atom:email { atomEmailAddress }?
032 *       &amp; extensionElement*)
033 * </p>
034 *
035 * <h5 class='section'>See Also:</h5><ul>
036 *    <li class='link'><a class="doclink" href="../../../../../index.html#jd.Atom">Overview &gt; juneau-dto &gt; Atom</a>
037 * </ul>
038 */
039@FluentSetters
040public class Person extends Common {
041
042   private String name;
043   private URI uri;
044   private String email;
045
046
047   /**
048    * Normal constructor.
049    *
050    * @param name The name of the person.
051    */
052   public Person(String name) {
053      setName(name);
054   }
055
056   /** Bean constructor. */
057   public Person() {}
058
059
060   //-----------------------------------------------------------------------------------------------------------------
061   // Bean properties
062   //-----------------------------------------------------------------------------------------------------------------
063
064   /**
065    * Bean property getter:  <property>name</property>.
066    *
067    * <p>
068    * The name of the person.
069    *
070    * @return The property value, or <jk>null</jk> if it is not set.
071    */
072   public String getName() {
073      return name;
074   }
075
076   /**
077    * Bean property setter:  <property>name</property>.
078    *
079    * <p>
080    * The name of the person.
081    *
082    * @param value
083    *    The new value for this property.
084    *    <br>Can be <jk>null</jk> to unset the property.
085    * @return This object
086    */
087   public Person setName(String value) {
088      this.name = value;
089      return this;
090   }
091
092   /**
093    * Bean property getter:  <property>uri</property>.
094    *
095    * <p>
096    * The URI of the person.
097    *
098    * @return The property value, or <jk>null</jk> if it is not set.
099    */
100   public URI getUri() {
101      return uri;
102   }
103
104   /**
105    * Bean property setter:  <property>uri</property>.
106    *
107    * <p>
108    * The URI of the person.
109    *
110    * <p>
111    * The value can be of any of the following types: {@link URI}, {@link URL}, {@link String}.
112    * Strings must be valid URIs.
113    *
114    * <p>
115    * URIs defined by {@link UriResolver} can be used for values.
116    *
117    * @param value
118    *    The new value for this property.
119    *    <br>Can be <jk>null</jk> to unset the property.
120    * @return This object
121    */
122   public Person setUri(Object value) {
123      this.uri = toURI(value);
124      return this;
125   }
126
127   /**
128    * Bean property getter:  <property>email</property>.
129    *
130    * <p>
131    * The email address of the person.
132    *
133    * @return The property value, or <jk>null</jk> if it is not set.
134    */
135   public String getEmail() {
136      return email;
137   }
138
139   /**
140    * Bean property setter:  <property>email</property>.
141    *
142    * <p>
143    * The email address of the person.
144    *
145    * @param value
146    *    The new value for this property.
147    *    <br>Can be <jk>null</jk> to unset the property.
148    * @return This object
149    */
150   public Person setEmail(String value) {
151      this.email = value;
152      return this;
153   }
154
155   //-----------------------------------------------------------------------------------------------------------------
156   // Overridden setters (to simplify method chaining)
157   //-----------------------------------------------------------------------------------------------------------------
158
159   // <FluentSetters>
160
161   @Override /* GENERATED - org.apache.juneau.dto.atom.Common */
162   public Person setBase(Object value) {
163      super.setBase(value);
164      return this;
165   }
166
167   @Override /* GENERATED - org.apache.juneau.dto.atom.Common */
168   public Person setLang(String value) {
169      super.setLang(value);
170      return this;
171   }
172
173   // </FluentSetters>
174}