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.annotation;
014
015import java.lang.annotation.*;
016
017import org.apache.juneau.*;
018import org.apache.juneau.rest.*;
019
020/**
021 * A concrete implementation of the {@link RestMethod} annotation.
022 *
023 * <ul class='seealso'>
024 *    <li class='jm'>{@link BeanContextBuilder#annotations(Annotation...)}
025 * </ul>
026 */
027@SuppressWarnings("unchecked")
028public class RestMethodAnnotation implements RestMethod {
029
030   private String
031      clientVersion = "",
032      debug = "",
033      defaultAccept = "",
034      defaultCharset = "",
035      defaultContentType = "",
036      maxInput = "",
037      name = "",
038      method = "",
039      path = "",
040      rolesDeclared = "",
041      roleGuard = "",
042      summary = "";
043
044   private String[]
045      attrs = new String[0],
046      bpi = new String[0],
047      bpx = new String[0],
048      defaultFormData = new String[0],
049      defaultQuery = new String[0],
050      defaultRequestHeaders = new String[0],
051      description = new String[0],
052      flags = new String[0],
053      paths = new String[0],
054      reqAttrs = new String[0],
055      reqHeaders = new String[0],
056      produces = new String[0],
057      consumes = new String[0];
058
059   private Class<?>[]
060      beanFilters = new Class<?>[0],
061      encoders = new Class<?>[0],
062      parsers = new Class<?>[0],
063      pojoSwaps = new Class<?>[0],
064      serializers = new Class<?>[0];
065
066   private Class<? extends RestConverter>[] converters = new Class[0];
067   private Class<? extends RestGuard>[] guards = new Class[0];
068   @SuppressWarnings("deprecation") private HtmlDoc htmldoc = null;
069   private Logging logging = new LoggingAnnotation();
070   private Class<? extends RestMatcher>[] matchers = new Class[0];
071   private int priority = 0;
072   private Property[] properties = new Property[0];
073   private MethodSwagger swagger = new MethodAnnotationSwagger();
074
075   /**
076    * Constructor.
077    */
078   public RestMethodAnnotation() {
079   }
080
081   @Override /* RestMethod */
082   public Class<? extends Annotation> annotationType() {
083      return RestMethod.class;
084   }
085
086   @Override /* RestMethod */
087   public String[] attrs() {
088      return attrs;
089   }
090
091   @Override /* RestMethod */
092   public Class<?>[] beanFilters() {
093      return beanFilters;
094   }
095
096   @Override /* RestMethod */
097   public String[] bpi() {
098      return bpi;
099   }
100
101   @Override /* RestMethod */
102   public String[] bpx() {
103      return bpx;
104   }
105
106   @Override /* RestMethod */
107   public String clientVersion() {
108      return clientVersion;
109   }
110
111   @Override /* RestMethod */
112   public Class<? extends RestConverter>[] converters() {
113      return converters;
114   }
115
116   @Override /* RestMethod */
117   public String debug() {
118      return debug;
119   }
120
121   @Override /* RestMethod */
122   public String defaultAccept() {
123      return defaultAccept;
124   }
125
126   @Override /* RestMethod */
127   public String defaultCharset() {
128      return defaultCharset;
129   }
130
131   @Override /* RestMethod */
132   public String defaultContentType() {
133      return defaultContentType;
134   }
135
136   @Override /* RestMethod */
137   public String[] defaultFormData() {
138      return defaultFormData;
139   }
140
141   @Override /* RestMethod */
142   public String[] defaultQuery() {
143      return defaultQuery;
144   }
145
146   @Override /* RestMethod */
147   public String[] defaultRequestHeaders() {
148      return defaultRequestHeaders;
149   }
150
151   @Override /* RestMethod */
152   public String[] description() {
153      return description;
154   }
155
156   @Override /* RestMethod */
157   public Class<?>[] encoders() {
158      return encoders;
159   }
160
161   @Override /* RestMethod */
162   public String[] flags() {
163      return flags;
164   }
165
166   @Override /* RestMethod */
167   public Class<? extends RestGuard>[] guards() {
168      return guards;
169   }
170
171   @SuppressWarnings("deprecation")
172   @Override /* RestMethod */
173   public HtmlDoc htmldoc() {
174      return htmldoc;
175   }
176
177   @Override /* RestMethod */
178   public Logging logging() {
179      return logging;
180   }
181
182   @Override /* RestMethod */
183   public Class<? extends RestMatcher>[] matchers() {
184      return matchers;
185   }
186
187   @Override /* RestMethod */
188   public String maxInput() {
189      return maxInput;
190   }
191
192   @Override /* RestMethod */
193   public String name() {
194      return name;
195   }
196
197   @Override /* RestMethod */
198   public String method() {
199      return method;
200   }
201
202   @Override /* RestMethod */
203   public Class<?>[] parsers() {
204      return parsers;
205   }
206
207   @Override /* RestMethod */
208   public String path() {
209      return path;
210   }
211
212   @Override /* RestMethod */
213   public String[] paths() {
214      return paths;
215   }
216
217   @Override /* RestMethod */
218   public Class<?>[] pojoSwaps() {
219      return pojoSwaps;
220   }
221
222   @Override /* RestMethod */
223   public int priority() {
224      return priority;
225   }
226
227   @Override /* RestMethod */
228   public Property[] properties() {
229      return properties;
230   }
231
232   @Override /* RestMethod */
233   public String[] reqAttrs() {
234      return reqAttrs;
235   }
236
237   @Override /* RestMethod */
238   public String[] reqHeaders() {
239      return reqHeaders;
240   }
241
242   @Override /* RestMethod */
243   public String rolesDeclared() {
244      return rolesDeclared;
245   }
246
247   @Override /* RestMethod */
248   public String roleGuard() {
249      return roleGuard;
250   }
251
252   @Override /* RestMethod */
253   public Class<?>[] serializers() {
254      return serializers;
255   }
256
257   @Override /* RestMethod */
258   public String summary() {
259      return summary;
260   }
261
262   @Override /* RestMethod */
263   public String[] produces() {
264      return produces;
265   }
266
267   @Override /* RestMethod */
268   public String[] consumes() {
269      return consumes;
270   }
271
272   @Override /* RestMethod */
273   public MethodSwagger swagger() {
274      return swagger;
275   }
276}