001/** 002 * Autogenerated by Avro 003 * 004 * DO NOT EDIT DIRECTLY 005 */ 006package org.apache.reef.io.watcher.common; 007@SuppressWarnings("all") 008@org.apache.avro.specific.AvroGenerated 009public class AvroFailure 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\":\"AvroFailure\",\"namespace\":\"org.apache.reef.io.watcher.common\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"message\",\"type\":\"string\"},{\"name\":\"description\",\"type\":[\"string\",\"null\"]},{\"name\":\"reason\",\"type\":[\"string\",\"null\"]},{\"name\":\"data\",\"type\":[\"bytes\",\"null\"]},{\"name\":\"asError\",\"type\":\"string\"}]}"); 011 public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } 012 @Deprecated public java.lang.CharSequence id; 013 @Deprecated public java.lang.CharSequence message; 014 @Deprecated public java.lang.CharSequence description; 015 @Deprecated public java.lang.CharSequence reason; 016 @Deprecated public java.nio.ByteBuffer data; 017 @Deprecated public java.lang.CharSequence asError; 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 AvroFailure() {} 025 026 /** 027 * All-args constructor. 028 */ 029 public AvroFailure(java.lang.CharSequence id, java.lang.CharSequence message, java.lang.CharSequence description, java.lang.CharSequence reason, java.nio.ByteBuffer data, java.lang.CharSequence asError) { 030 this.id = id; 031 this.message = message; 032 this.description = description; 033 this.reason = reason; 034 this.data = data; 035 this.asError = asError; 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 id; 043 case 1: return message; 044 case 2: return description; 045 case 3: return reason; 046 case 4: return data; 047 case 5: return asError; 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: id = (java.lang.CharSequence)value$; break; 056 case 1: message = (java.lang.CharSequence)value$; break; 057 case 2: description = (java.lang.CharSequence)value$; break; 058 case 3: reason = (java.lang.CharSequence)value$; break; 059 case 4: data = (java.nio.ByteBuffer)value$; break; 060 case 5: asError = (java.lang.CharSequence)value$; break; 061 default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 062 } 063 } 064 065 /** 066 * Gets the value of the 'id' field. 067 */ 068 public java.lang.CharSequence getId() { 069 return id; 070 } 071 072 /** 073 * Sets the value of the 'id' field. 074 * @param value the value to set. 075 */ 076 public void setId(java.lang.CharSequence value) { 077 this.id = value; 078 } 079 080 /** 081 * Gets the value of the 'message' field. 082 */ 083 public java.lang.CharSequence getMessage() { 084 return message; 085 } 086 087 /** 088 * Sets the value of the 'message' field. 089 * @param value the value to set. 090 */ 091 public void setMessage(java.lang.CharSequence value) { 092 this.message = value; 093 } 094 095 /** 096 * Gets the value of the 'description' field. 097 */ 098 public java.lang.CharSequence getDescription() { 099 return description; 100 } 101 102 /** 103 * Sets the value of the 'description' field. 104 * @param value the value to set. 105 */ 106 public void setDescription(java.lang.CharSequence value) { 107 this.description = value; 108 } 109 110 /** 111 * Gets the value of the 'reason' field. 112 */ 113 public java.lang.CharSequence getReason() { 114 return reason; 115 } 116 117 /** 118 * Sets the value of the 'reason' field. 119 * @param value the value to set. 120 */ 121 public void setReason(java.lang.CharSequence value) { 122 this.reason = value; 123 } 124 125 /** 126 * Gets the value of the 'data' field. 127 */ 128 public java.nio.ByteBuffer getData() { 129 return data; 130 } 131 132 /** 133 * Sets the value of the 'data' field. 134 * @param value the value to set. 135 */ 136 public void setData(java.nio.ByteBuffer value) { 137 this.data = value; 138 } 139 140 /** 141 * Gets the value of the 'asError' field. 142 */ 143 public java.lang.CharSequence getAsError() { 144 return asError; 145 } 146 147 /** 148 * Sets the value of the 'asError' field. 149 * @param value the value to set. 150 */ 151 public void setAsError(java.lang.CharSequence value) { 152 this.asError = value; 153 } 154 155 /** Creates a new AvroFailure RecordBuilder */ 156 public static org.apache.reef.io.watcher.common.AvroFailure.Builder newBuilder() { 157 return new org.apache.reef.io.watcher.common.AvroFailure.Builder(); 158 } 159 160 /** Creates a new AvroFailure RecordBuilder by copying an existing Builder */ 161 public static org.apache.reef.io.watcher.common.AvroFailure.Builder newBuilder(org.apache.reef.io.watcher.common.AvroFailure.Builder other) { 162 return new org.apache.reef.io.watcher.common.AvroFailure.Builder(other); 163 } 164 165 /** Creates a new AvroFailure RecordBuilder by copying an existing AvroFailure instance */ 166 public static org.apache.reef.io.watcher.common.AvroFailure.Builder newBuilder(org.apache.reef.io.watcher.common.AvroFailure other) { 167 return new org.apache.reef.io.watcher.common.AvroFailure.Builder(other); 168 } 169 170 /** 171 * RecordBuilder for AvroFailure instances. 172 */ 173 public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroFailure> 174 implements org.apache.avro.data.RecordBuilder<AvroFailure> { 175 176 private java.lang.CharSequence id; 177 private java.lang.CharSequence message; 178 private java.lang.CharSequence description; 179 private java.lang.CharSequence reason; 180 private java.nio.ByteBuffer data; 181 private java.lang.CharSequence asError; 182 183 /** Creates a new Builder */ 184 private Builder() { 185 super(org.apache.reef.io.watcher.common.AvroFailure.SCHEMA$); 186 } 187 188 /** Creates a Builder by copying an existing Builder */ 189 private Builder(org.apache.reef.io.watcher.common.AvroFailure.Builder other) { 190 super(other); 191 if (isValidValue(fields()[0], other.id)) { 192 this.id = data().deepCopy(fields()[0].schema(), other.id); 193 fieldSetFlags()[0] = true; 194 } 195 if (isValidValue(fields()[1], other.message)) { 196 this.message = data().deepCopy(fields()[1].schema(), other.message); 197 fieldSetFlags()[1] = true; 198 } 199 if (isValidValue(fields()[2], other.description)) { 200 this.description = data().deepCopy(fields()[2].schema(), other.description); 201 fieldSetFlags()[2] = true; 202 } 203 if (isValidValue(fields()[3], other.reason)) { 204 this.reason = data().deepCopy(fields()[3].schema(), other.reason); 205 fieldSetFlags()[3] = true; 206 } 207 if (isValidValue(fields()[4], other.data)) { 208 this.data = data().deepCopy(fields()[4].schema(), other.data); 209 fieldSetFlags()[4] = true; 210 } 211 if (isValidValue(fields()[5], other.asError)) { 212 this.asError = data().deepCopy(fields()[5].schema(), other.asError); 213 fieldSetFlags()[5] = true; 214 } 215 } 216 217 /** Creates a Builder by copying an existing AvroFailure instance */ 218 private Builder(org.apache.reef.io.watcher.common.AvroFailure other) { 219 super(org.apache.reef.io.watcher.common.AvroFailure.SCHEMA$); 220 if (isValidValue(fields()[0], other.id)) { 221 this.id = data().deepCopy(fields()[0].schema(), other.id); 222 fieldSetFlags()[0] = true; 223 } 224 if (isValidValue(fields()[1], other.message)) { 225 this.message = data().deepCopy(fields()[1].schema(), other.message); 226 fieldSetFlags()[1] = true; 227 } 228 if (isValidValue(fields()[2], other.description)) { 229 this.description = data().deepCopy(fields()[2].schema(), other.description); 230 fieldSetFlags()[2] = true; 231 } 232 if (isValidValue(fields()[3], other.reason)) { 233 this.reason = data().deepCopy(fields()[3].schema(), other.reason); 234 fieldSetFlags()[3] = true; 235 } 236 if (isValidValue(fields()[4], other.data)) { 237 this.data = data().deepCopy(fields()[4].schema(), other.data); 238 fieldSetFlags()[4] = true; 239 } 240 if (isValidValue(fields()[5], other.asError)) { 241 this.asError = data().deepCopy(fields()[5].schema(), other.asError); 242 fieldSetFlags()[5] = true; 243 } 244 } 245 246 /** Gets the value of the 'id' field */ 247 public java.lang.CharSequence getId() { 248 return id; 249 } 250 251 /** Sets the value of the 'id' field */ 252 public org.apache.reef.io.watcher.common.AvroFailure.Builder setId(java.lang.CharSequence value) { 253 validate(fields()[0], value); 254 this.id = value; 255 fieldSetFlags()[0] = true; 256 return this; 257 } 258 259 /** Checks whether the 'id' field has been set */ 260 public boolean hasId() { 261 return fieldSetFlags()[0]; 262 } 263 264 /** Clears the value of the 'id' field */ 265 public org.apache.reef.io.watcher.common.AvroFailure.Builder clearId() { 266 id = null; 267 fieldSetFlags()[0] = false; 268 return this; 269 } 270 271 /** Gets the value of the 'message' field */ 272 public java.lang.CharSequence getMessage() { 273 return message; 274 } 275 276 /** Sets the value of the 'message' field */ 277 public org.apache.reef.io.watcher.common.AvroFailure.Builder setMessage(java.lang.CharSequence value) { 278 validate(fields()[1], value); 279 this.message = value; 280 fieldSetFlags()[1] = true; 281 return this; 282 } 283 284 /** Checks whether the 'message' field has been set */ 285 public boolean hasMessage() { 286 return fieldSetFlags()[1]; 287 } 288 289 /** Clears the value of the 'message' field */ 290 public org.apache.reef.io.watcher.common.AvroFailure.Builder clearMessage() { 291 message = null; 292 fieldSetFlags()[1] = false; 293 return this; 294 } 295 296 /** Gets the value of the 'description' field */ 297 public java.lang.CharSequence getDescription() { 298 return description; 299 } 300 301 /** Sets the value of the 'description' field */ 302 public org.apache.reef.io.watcher.common.AvroFailure.Builder setDescription(java.lang.CharSequence value) { 303 validate(fields()[2], value); 304 this.description = value; 305 fieldSetFlags()[2] = true; 306 return this; 307 } 308 309 /** Checks whether the 'description' field has been set */ 310 public boolean hasDescription() { 311 return fieldSetFlags()[2]; 312 } 313 314 /** Clears the value of the 'description' field */ 315 public org.apache.reef.io.watcher.common.AvroFailure.Builder clearDescription() { 316 description = null; 317 fieldSetFlags()[2] = false; 318 return this; 319 } 320 321 /** Gets the value of the 'reason' field */ 322 public java.lang.CharSequence getReason() { 323 return reason; 324 } 325 326 /** Sets the value of the 'reason' field */ 327 public org.apache.reef.io.watcher.common.AvroFailure.Builder setReason(java.lang.CharSequence value) { 328 validate(fields()[3], value); 329 this.reason = value; 330 fieldSetFlags()[3] = true; 331 return this; 332 } 333 334 /** Checks whether the 'reason' field has been set */ 335 public boolean hasReason() { 336 return fieldSetFlags()[3]; 337 } 338 339 /** Clears the value of the 'reason' field */ 340 public org.apache.reef.io.watcher.common.AvroFailure.Builder clearReason() { 341 reason = null; 342 fieldSetFlags()[3] = false; 343 return this; 344 } 345 346 /** Gets the value of the 'data' field */ 347 public java.nio.ByteBuffer getData() { 348 return data; 349 } 350 351 /** Sets the value of the 'data' field */ 352 public org.apache.reef.io.watcher.common.AvroFailure.Builder setData(java.nio.ByteBuffer value) { 353 validate(fields()[4], value); 354 this.data = value; 355 fieldSetFlags()[4] = true; 356 return this; 357 } 358 359 /** Checks whether the 'data' field has been set */ 360 public boolean hasData() { 361 return fieldSetFlags()[4]; 362 } 363 364 /** Clears the value of the 'data' field */ 365 public org.apache.reef.io.watcher.common.AvroFailure.Builder clearData() { 366 data = null; 367 fieldSetFlags()[4] = false; 368 return this; 369 } 370 371 /** Gets the value of the 'asError' field */ 372 public java.lang.CharSequence getAsError() { 373 return asError; 374 } 375 376 /** Sets the value of the 'asError' field */ 377 public org.apache.reef.io.watcher.common.AvroFailure.Builder setAsError(java.lang.CharSequence value) { 378 validate(fields()[5], value); 379 this.asError = value; 380 fieldSetFlags()[5] = true; 381 return this; 382 } 383 384 /** Checks whether the 'asError' field has been set */ 385 public boolean hasAsError() { 386 return fieldSetFlags()[5]; 387 } 388 389 /** Clears the value of the 'asError' field */ 390 public org.apache.reef.io.watcher.common.AvroFailure.Builder clearAsError() { 391 asError = null; 392 fieldSetFlags()[5] = false; 393 return this; 394 } 395 396 @Override 397 public AvroFailure build() { 398 try { 399 AvroFailure record = new AvroFailure(); 400 record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]); 401 record.message = fieldSetFlags()[1] ? this.message : (java.lang.CharSequence) defaultValue(fields()[1]); 402 record.description = fieldSetFlags()[2] ? this.description : (java.lang.CharSequence) defaultValue(fields()[2]); 403 record.reason = fieldSetFlags()[3] ? this.reason : (java.lang.CharSequence) defaultValue(fields()[3]); 404 record.data = fieldSetFlags()[4] ? this.data : (java.nio.ByteBuffer) defaultValue(fields()[4]); 405 record.asError = fieldSetFlags()[5] ? this.asError : (java.lang.CharSequence) defaultValue(fields()[5]); 406 return record; 407 } catch (Exception e) { 408 throw new org.apache.avro.AvroRuntimeException(e); 409 } 410 } 411 } 412}