001/** 002 * Autogenerated by Avro 003 * 004 * DO NOT EDIT DIRECTLY 005 */ 006package org.apache.reef.webserver; 007@SuppressWarnings("all") 008@org.apache.avro.specific.AvroGenerated 009public class AvroHttpRequest extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { 010 public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroHttpRequest\",\"namespace\":\"org.apache.reef.webserver\",\"fields\":[{\"name\":\"header\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"HeaderEntry\",\"fields\":[{\"name\":\"key\",\"type\":\"string\"},{\"name\":\"value\",\"type\":\"string\"}]}}},{\"name\":\"requestUrl\",\"type\":\"string\"},{\"name\":\"pathInfo\",\"type\":\"string\"},{\"name\":\"queryString\",\"type\":\"string\"},{\"name\":\"httpMethod\",\"type\":\"string\"},{\"name\":\"inputStream\",\"type\":\"bytes\"}]}"); 011 public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } 012 @Deprecated public java.util.List<org.apache.reef.webserver.HeaderEntry> header; 013 @Deprecated public java.lang.CharSequence requestUrl; 014 @Deprecated public java.lang.CharSequence pathInfo; 015 @Deprecated public java.lang.CharSequence queryString; 016 @Deprecated public java.lang.CharSequence httpMethod; 017 @Deprecated public java.nio.ByteBuffer inputStream; 018 019 /** 020 * Default constructor. Note that this does not initialize fields 021 * to their default values from the schema. If that is desired then 022 * one should use <code>newBuilder()</code>. 023 */ 024 public AvroHttpRequest() {} 025 026 /** 027 * All-args constructor. 028 */ 029 public AvroHttpRequest(java.util.List<org.apache.reef.webserver.HeaderEntry> header, java.lang.CharSequence requestUrl, java.lang.CharSequence pathInfo, java.lang.CharSequence queryString, java.lang.CharSequence httpMethod, java.nio.ByteBuffer inputStream) { 030 this.header = header; 031 this.requestUrl = requestUrl; 032 this.pathInfo = pathInfo; 033 this.queryString = queryString; 034 this.httpMethod = httpMethod; 035 this.inputStream = inputStream; 036 } 037 038 public org.apache.avro.Schema getSchema() { return SCHEMA$; } 039 // Used by DatumWriter. Applications should not call. 040 public java.lang.Object get(int field$) { 041 switch (field$) { 042 case 0: return header; 043 case 1: return requestUrl; 044 case 2: return pathInfo; 045 case 3: return queryString; 046 case 4: return httpMethod; 047 case 5: return inputStream; 048 default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 049 } 050 } 051 // Used by DatumReader. Applications should not call. 052 @SuppressWarnings(value="unchecked") 053 public void put(int field$, java.lang.Object value$) { 054 switch (field$) { 055 case 0: header = (java.util.List<org.apache.reef.webserver.HeaderEntry>)value$; break; 056 case 1: requestUrl = (java.lang.CharSequence)value$; break; 057 case 2: pathInfo = (java.lang.CharSequence)value$; break; 058 case 3: queryString = (java.lang.CharSequence)value$; break; 059 case 4: httpMethod = (java.lang.CharSequence)value$; break; 060 case 5: inputStream = (java.nio.ByteBuffer)value$; break; 061 default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 062 } 063 } 064 065 /** 066 * Gets the value of the 'header' field. 067 */ 068 public java.util.List<org.apache.reef.webserver.HeaderEntry> getHeader() { 069 return header; 070 } 071 072 /** 073 * Sets the value of the 'header' field. 074 * @param value the value to set. 075 */ 076 public void setHeader(java.util.List<org.apache.reef.webserver.HeaderEntry> value) { 077 this.header = value; 078 } 079 080 /** 081 * Gets the value of the 'requestUrl' field. 082 */ 083 public java.lang.CharSequence getRequestUrl() { 084 return requestUrl; 085 } 086 087 /** 088 * Sets the value of the 'requestUrl' field. 089 * @param value the value to set. 090 */ 091 public void setRequestUrl(java.lang.CharSequence value) { 092 this.requestUrl = value; 093 } 094 095 /** 096 * Gets the value of the 'pathInfo' field. 097 */ 098 public java.lang.CharSequence getPathInfo() { 099 return pathInfo; 100 } 101 102 /** 103 * Sets the value of the 'pathInfo' field. 104 * @param value the value to set. 105 */ 106 public void setPathInfo(java.lang.CharSequence value) { 107 this.pathInfo = value; 108 } 109 110 /** 111 * Gets the value of the 'queryString' field. 112 */ 113 public java.lang.CharSequence getQueryString() { 114 return queryString; 115 } 116 117 /** 118 * Sets the value of the 'queryString' field. 119 * @param value the value to set. 120 */ 121 public void setQueryString(java.lang.CharSequence value) { 122 this.queryString = value; 123 } 124 125 /** 126 * Gets the value of the 'httpMethod' field. 127 */ 128 public java.lang.CharSequence getHttpMethod() { 129 return httpMethod; 130 } 131 132 /** 133 * Sets the value of the 'httpMethod' field. 134 * @param value the value to set. 135 */ 136 public void setHttpMethod(java.lang.CharSequence value) { 137 this.httpMethod = value; 138 } 139 140 /** 141 * Gets the value of the 'inputStream' field. 142 */ 143 public java.nio.ByteBuffer getInputStream() { 144 return inputStream; 145 } 146 147 /** 148 * Sets the value of the 'inputStream' field. 149 * @param value the value to set. 150 */ 151 public void setInputStream(java.nio.ByteBuffer value) { 152 this.inputStream = value; 153 } 154 155 /** Creates a new AvroHttpRequest RecordBuilder */ 156 public static org.apache.reef.webserver.AvroHttpRequest.Builder newBuilder() { 157 return new org.apache.reef.webserver.AvroHttpRequest.Builder(); 158 } 159 160 /** Creates a new AvroHttpRequest RecordBuilder by copying an existing Builder */ 161 public static org.apache.reef.webserver.AvroHttpRequest.Builder newBuilder(org.apache.reef.webserver.AvroHttpRequest.Builder other) { 162 return new org.apache.reef.webserver.AvroHttpRequest.Builder(other); 163 } 164 165 /** Creates a new AvroHttpRequest RecordBuilder by copying an existing AvroHttpRequest instance */ 166 public static org.apache.reef.webserver.AvroHttpRequest.Builder newBuilder(org.apache.reef.webserver.AvroHttpRequest other) { 167 return new org.apache.reef.webserver.AvroHttpRequest.Builder(other); 168 } 169 170 /** 171 * RecordBuilder for AvroHttpRequest instances. 172 */ 173 public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroHttpRequest> 174 implements org.apache.avro.data.RecordBuilder<AvroHttpRequest> { 175 176 private java.util.List<org.apache.reef.webserver.HeaderEntry> header; 177 private java.lang.CharSequence requestUrl; 178 private java.lang.CharSequence pathInfo; 179 private java.lang.CharSequence queryString; 180 private java.lang.CharSequence httpMethod; 181 private java.nio.ByteBuffer inputStream; 182 183 /** Creates a new Builder */ 184 private Builder() { 185 super(org.apache.reef.webserver.AvroHttpRequest.SCHEMA$); 186 } 187 188 /** Creates a Builder by copying an existing Builder */ 189 private Builder(org.apache.reef.webserver.AvroHttpRequest.Builder other) { 190 super(other); 191 if (isValidValue(fields()[0], other.header)) { 192 this.header = data().deepCopy(fields()[0].schema(), other.header); 193 fieldSetFlags()[0] = true; 194 } 195 if (isValidValue(fields()[1], other.requestUrl)) { 196 this.requestUrl = data().deepCopy(fields()[1].schema(), other.requestUrl); 197 fieldSetFlags()[1] = true; 198 } 199 if (isValidValue(fields()[2], other.pathInfo)) { 200 this.pathInfo = data().deepCopy(fields()[2].schema(), other.pathInfo); 201 fieldSetFlags()[2] = true; 202 } 203 if (isValidValue(fields()[3], other.queryString)) { 204 this.queryString = data().deepCopy(fields()[3].schema(), other.queryString); 205 fieldSetFlags()[3] = true; 206 } 207 if (isValidValue(fields()[4], other.httpMethod)) { 208 this.httpMethod = data().deepCopy(fields()[4].schema(), other.httpMethod); 209 fieldSetFlags()[4] = true; 210 } 211 if (isValidValue(fields()[5], other.inputStream)) { 212 this.inputStream = data().deepCopy(fields()[5].schema(), other.inputStream); 213 fieldSetFlags()[5] = true; 214 } 215 } 216 217 /** Creates a Builder by copying an existing AvroHttpRequest instance */ 218 private Builder(org.apache.reef.webserver.AvroHttpRequest other) { 219 super(org.apache.reef.webserver.AvroHttpRequest.SCHEMA$); 220 if (isValidValue(fields()[0], other.header)) { 221 this.header = data().deepCopy(fields()[0].schema(), other.header); 222 fieldSetFlags()[0] = true; 223 } 224 if (isValidValue(fields()[1], other.requestUrl)) { 225 this.requestUrl = data().deepCopy(fields()[1].schema(), other.requestUrl); 226 fieldSetFlags()[1] = true; 227 } 228 if (isValidValue(fields()[2], other.pathInfo)) { 229 this.pathInfo = data().deepCopy(fields()[2].schema(), other.pathInfo); 230 fieldSetFlags()[2] = true; 231 } 232 if (isValidValue(fields()[3], other.queryString)) { 233 this.queryString = data().deepCopy(fields()[3].schema(), other.queryString); 234 fieldSetFlags()[3] = true; 235 } 236 if (isValidValue(fields()[4], other.httpMethod)) { 237 this.httpMethod = data().deepCopy(fields()[4].schema(), other.httpMethod); 238 fieldSetFlags()[4] = true; 239 } 240 if (isValidValue(fields()[5], other.inputStream)) { 241 this.inputStream = data().deepCopy(fields()[5].schema(), other.inputStream); 242 fieldSetFlags()[5] = true; 243 } 244 } 245 246 /** Gets the value of the 'header' field */ 247 public java.util.List<org.apache.reef.webserver.HeaderEntry> getHeader() { 248 return header; 249 } 250 251 /** Sets the value of the 'header' field */ 252 public org.apache.reef.webserver.AvroHttpRequest.Builder setHeader(java.util.List<org.apache.reef.webserver.HeaderEntry> value) { 253 validate(fields()[0], value); 254 this.header = value; 255 fieldSetFlags()[0] = true; 256 return this; 257 } 258 259 /** Checks whether the 'header' field has been set */ 260 public boolean hasHeader() { 261 return fieldSetFlags()[0]; 262 } 263 264 /** Clears the value of the 'header' field */ 265 public org.apache.reef.webserver.AvroHttpRequest.Builder clearHeader() { 266 header = null; 267 fieldSetFlags()[0] = false; 268 return this; 269 } 270 271 /** Gets the value of the 'requestUrl' field */ 272 public java.lang.CharSequence getRequestUrl() { 273 return requestUrl; 274 } 275 276 /** Sets the value of the 'requestUrl' field */ 277 public org.apache.reef.webserver.AvroHttpRequest.Builder setRequestUrl(java.lang.CharSequence value) { 278 validate(fields()[1], value); 279 this.requestUrl = value; 280 fieldSetFlags()[1] = true; 281 return this; 282 } 283 284 /** Checks whether the 'requestUrl' field has been set */ 285 public boolean hasRequestUrl() { 286 return fieldSetFlags()[1]; 287 } 288 289 /** Clears the value of the 'requestUrl' field */ 290 public org.apache.reef.webserver.AvroHttpRequest.Builder clearRequestUrl() { 291 requestUrl = null; 292 fieldSetFlags()[1] = false; 293 return this; 294 } 295 296 /** Gets the value of the 'pathInfo' field */ 297 public java.lang.CharSequence getPathInfo() { 298 return pathInfo; 299 } 300 301 /** Sets the value of the 'pathInfo' field */ 302 public org.apache.reef.webserver.AvroHttpRequest.Builder setPathInfo(java.lang.CharSequence value) { 303 validate(fields()[2], value); 304 this.pathInfo = value; 305 fieldSetFlags()[2] = true; 306 return this; 307 } 308 309 /** Checks whether the 'pathInfo' field has been set */ 310 public boolean hasPathInfo() { 311 return fieldSetFlags()[2]; 312 } 313 314 /** Clears the value of the 'pathInfo' field */ 315 public org.apache.reef.webserver.AvroHttpRequest.Builder clearPathInfo() { 316 pathInfo = null; 317 fieldSetFlags()[2] = false; 318 return this; 319 } 320 321 /** Gets the value of the 'queryString' field */ 322 public java.lang.CharSequence getQueryString() { 323 return queryString; 324 } 325 326 /** Sets the value of the 'queryString' field */ 327 public org.apache.reef.webserver.AvroHttpRequest.Builder setQueryString(java.lang.CharSequence value) { 328 validate(fields()[3], value); 329 this.queryString = value; 330 fieldSetFlags()[3] = true; 331 return this; 332 } 333 334 /** Checks whether the 'queryString' field has been set */ 335 public boolean hasQueryString() { 336 return fieldSetFlags()[3]; 337 } 338 339 /** Clears the value of the 'queryString' field */ 340 public org.apache.reef.webserver.AvroHttpRequest.Builder clearQueryString() { 341 queryString = null; 342 fieldSetFlags()[3] = false; 343 return this; 344 } 345 346 /** Gets the value of the 'httpMethod' field */ 347 public java.lang.CharSequence getHttpMethod() { 348 return httpMethod; 349 } 350 351 /** Sets the value of the 'httpMethod' field */ 352 public org.apache.reef.webserver.AvroHttpRequest.Builder setHttpMethod(java.lang.CharSequence value) { 353 validate(fields()[4], value); 354 this.httpMethod = value; 355 fieldSetFlags()[4] = true; 356 return this; 357 } 358 359 /** Checks whether the 'httpMethod' field has been set */ 360 public boolean hasHttpMethod() { 361 return fieldSetFlags()[4]; 362 } 363 364 /** Clears the value of the 'httpMethod' field */ 365 public org.apache.reef.webserver.AvroHttpRequest.Builder clearHttpMethod() { 366 httpMethod = null; 367 fieldSetFlags()[4] = false; 368 return this; 369 } 370 371 /** Gets the value of the 'inputStream' field */ 372 public java.nio.ByteBuffer getInputStream() { 373 return inputStream; 374 } 375 376 /** Sets the value of the 'inputStream' field */ 377 public org.apache.reef.webserver.AvroHttpRequest.Builder setInputStream(java.nio.ByteBuffer value) { 378 validate(fields()[5], value); 379 this.inputStream = value; 380 fieldSetFlags()[5] = true; 381 return this; 382 } 383 384 /** Checks whether the 'inputStream' field has been set */ 385 public boolean hasInputStream() { 386 return fieldSetFlags()[5]; 387 } 388 389 /** Clears the value of the 'inputStream' field */ 390 public org.apache.reef.webserver.AvroHttpRequest.Builder clearInputStream() { 391 inputStream = null; 392 fieldSetFlags()[5] = false; 393 return this; 394 } 395 396 @Override 397 public AvroHttpRequest build() { 398 try { 399 AvroHttpRequest record = new AvroHttpRequest(); 400 record.header = fieldSetFlags()[0] ? this.header : (java.util.List<org.apache.reef.webserver.HeaderEntry>) defaultValue(fields()[0]); 401 record.requestUrl = fieldSetFlags()[1] ? this.requestUrl : (java.lang.CharSequence) defaultValue(fields()[1]); 402 record.pathInfo = fieldSetFlags()[2] ? this.pathInfo : (java.lang.CharSequence) defaultValue(fields()[2]); 403 record.queryString = fieldSetFlags()[3] ? this.queryString : (java.lang.CharSequence) defaultValue(fields()[3]); 404 record.httpMethod = fieldSetFlags()[4] ? this.httpMethod : (java.lang.CharSequence) defaultValue(fields()[4]); 405 record.inputStream = fieldSetFlags()[5] ? this.inputStream : (java.nio.ByteBuffer) defaultValue(fields()[5]); 406 return record; 407 } catch (Exception e) { 408 throw new org.apache.avro.AvroRuntimeException(e); 409 } 410 } 411 } 412}