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