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