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.http.annotation;
014
015import java.lang.annotation.*;
016
017import org.apache.juneau.jsonschema.annotation.*;
018
019/**
020 * A concrete implementation of the {@link Body} annotation.
021 */
022public class BodyAnnotation implements Body {
023
024   private String[] description={}, d={}, example={}, ex={}, examples={}, exs={}, value={}, api={};
025   private boolean required, r;
026   private Schema schema = new SchemaAnnotation();
027
028   @Override /* Annotation */
029   public Class<? extends Annotation> annotationType() {
030      return Body.class;
031   }
032
033   @Override /* Body */
034   public String[] description() {
035      return description;
036   }
037
038   /**
039    * Sets the <c>description</c> property on this annotation.
040    *
041    * @param value The new value for this property.
042    * @return This object (for method chaining).
043    */
044   public BodyAnnotation description(String[] value) {
045      this.description = value;
046      return this;
047   }
048
049   @Override /* Body */
050   public String[] d() {
051      return d;
052   }
053
054   /**
055    * Sets the <c>d</c> property on this annotation.
056    *
057    * @param value The new value for this property.
058    * @return This object (for method chaining).
059    */
060   public BodyAnnotation d(String[] value) {
061      this.d = value;
062      return this;
063   }
064
065   @Override /* Body */
066   public boolean required() {
067      return required;
068   }
069
070   /**
071    * Sets the <c>required</c> property on this annotation.
072    *
073    * @param value The new value for this property.
074    * @return This object (for method chaining).
075    */
076   public BodyAnnotation required(boolean value) {
077      this.required = value;
078      return this;
079   }
080
081   @Override /* Body */
082   public boolean r() {
083      return r;
084   }
085
086   /**
087    * Sets the <c>r</c> property on this annotation.
088    *
089    * @param value The new value for this property.
090    * @return This object (for method chaining).
091    */
092   public BodyAnnotation r(boolean value) {
093      this.r = value;
094      return this;
095   }
096
097   @Override /* Body */
098   public Schema schema() {
099      return schema;
100   }
101
102   /**
103    * Sets the <c>schema</c> property on this annotation.
104    *
105    * @param value The new value for this property.
106    * @return This object (for method chaining).
107    */
108   public BodyAnnotation schema(Schema value) {
109      this.schema = value;
110      return this;
111   }
112
113   @Override /* Body */
114   public String[] example() {
115      return example;
116   }
117
118   /**
119    * Sets the <c>example</c> property on this annotation.
120    *
121    * @param value The new value for this property.
122    * @return This object (for method chaining).
123    */
124   public BodyAnnotation example(String[] value) {
125      this.example = value;
126      return this;
127   }
128
129   @Override /* Body */
130   public String[] ex() {
131      return ex;
132   }
133
134   /**
135    * Sets the <c>ex</c> property on this annotation.
136    *
137    * @param value The new value for this property.
138    * @return This object (for method chaining).
139    */
140   public BodyAnnotation ex(String[] value) {
141      this.ex = value;
142      return this;
143   }
144
145   @Override /* Body */
146   public String[] examples() {
147      return examples;
148   }
149
150   /**
151    * Sets the <c>examples</c> property on this annotation.
152    *
153    * @param value The new value for this property.
154    * @return This object (for method chaining).
155    */
156   public BodyAnnotation examples(String[] value) {
157      this.examples = value;
158      return this;
159   }
160
161   @Override /* Body */
162   public String[] exs() {
163      return exs;
164   }
165
166   /**
167    * Sets the <c>exs</c> property on this annotation.
168    *
169    * @param value The new value for this property.
170    * @return This object (for method chaining).
171    */
172   public BodyAnnotation exs(String[] value) {
173      this.exs = value;
174      return this;
175   }
176
177   @Override /* Body */
178   public String[] value() {
179      return value;
180   }
181
182   /**
183    * Sets the <c>value</c> property on this annotation.
184    *
185    * @param value The new value for this property.
186    * @return This object (for method chaining).
187    */
188   public BodyAnnotation value(String[] value) {
189      this.value = value;
190      return this;
191   }
192
193   @Override /* Body */
194   public String[] api() {
195      return api;
196   }
197
198   /**
199    * Sets the <c>api</c> property on this annotation.
200    *
201    * @param value The new value for this property.
202    * @return This object (for method chaining).
203    */
204   public BodyAnnotation api(String[] value) {
205      this.api = value;
206      return this;
207   }
208}