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.rest.labels;
014
015import org.apache.juneau.annotation.*;
016
017/**
018 * Simple bean with {@code name} and {@code description} properties.
019 * 
020 * <p>
021 * Primarily used for constructing tables with name/description columns on REST OPTIONS requests.
022 * 
023 * <h5 class='section'>See Also:</h5>
024 * <ul>
025 *    <li class='link'><a class="doclink" href="../../../../../overview-summary.html#juneau-rest-server.PredefinedLabelBeans">Overview &gt; juneau-rest-server &gt; Predefined Label Beans</a>
026 * </ul>
027 */
028@Bean(properties="name,description")
029public class NameDescription {
030
031   private Object name;
032   private Object description;
033
034   /** No-arg constructor.  Used for JUnit testing of OPTIONS pages. */
035   public NameDescription() {}
036
037   /**
038    * Constructor.
039    * 
040    * @param name A name.
041    * @param description A description.
042    */
043   public NameDescription(Object name, Object description) {
044      this.name = name;
045      this.description = description;
046   }
047
048   /**
049    * Returns the name field on this label.
050    * 
051    * @return The name.
052    */
053   public Object getName() {
054      return name;
055   }
056
057   /**
058    * Sets the name field on this label to a new value.
059    * 
060    * @param name The new name.
061    * @return This object (for method chaining).
062    */
063   @BeanProperty
064   public NameDescription name(Object name) {
065      this.name = name;
066      return this;
067   }
068
069   /**
070    * Returns the description field on this label.
071    * 
072    * @return The description.
073    */
074   public Object getDescription() {
075      return description;
076   }
077
078   /**
079    * Sets the description field on this label to a new value.
080    * 
081    * @param description The new description.
082    * @return This object (for method chaining).
083    */
084   @BeanProperty
085   public NameDescription description(Object description) {
086      this.description = description;
087      return this;
088   }
089}