001/** 002 * Autogenerated by Avro 003 * 004 * DO NOT EDIT DIRECTLY 005 */ 006package org.apache.reef.javabridge.avro; 007@SuppressWarnings("all") 008/** Defines the schema for failed task. Tunnels Task failures from C# Evaluator to Java Driver to C# Driver. */ 009@org.apache.avro.specific.AvroGenerated 010public class AvroFailedTask extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { 011 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.\"}]}"); 012 public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } 013 /** The Task ID of the failed Task. */ 014 @Deprecated public java.lang.CharSequence identifier; 015 /** The data passed back from the Failed Task, if any. */ 016 @Deprecated public java.nio.ByteBuffer data; 017 /** The serialized Exception of that caused the Task failure. */ 018 @Deprecated public java.nio.ByteBuffer cause; 019 /** The message of the Task failure, if any. */ 020 @Deprecated public java.lang.CharSequence message; 021 022 /** 023 * Default constructor. Note that this does not initialize fields 024 * to their default values from the schema. If that is desired then 025 * one should use <code>newBuilder()</code>. 026 */ 027 public AvroFailedTask() {} 028 029 /** 030 * All-args constructor. 031 */ 032 public AvroFailedTask(java.lang.CharSequence identifier, java.nio.ByteBuffer data, java.nio.ByteBuffer cause, java.lang.CharSequence message) { 033 this.identifier = identifier; 034 this.data = data; 035 this.cause = cause; 036 this.message = message; 037 } 038 039 public org.apache.avro.Schema getSchema() { return SCHEMA$; } 040 // Used by DatumWriter. Applications should not call. 041 public java.lang.Object get(int field$) { 042 switch (field$) { 043 case 0: return identifier; 044 case 1: return data; 045 case 2: return cause; 046 case 3: return message; 047 default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 048 } 049 } 050 // Used by DatumReader. Applications should not call. 051 @SuppressWarnings(value="unchecked") 052 public void put(int field$, java.lang.Object value$) { 053 switch (field$) { 054 case 0: identifier = (java.lang.CharSequence)value$; break; 055 case 1: data = (java.nio.ByteBuffer)value$; break; 056 case 2: cause = (java.nio.ByteBuffer)value$; break; 057 case 3: message = (java.lang.CharSequence)value$; break; 058 default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 059 } 060 } 061 062 /** 063 * Gets the value of the 'identifier' field. 064 * The Task ID of the failed Task. */ 065 public java.lang.CharSequence getIdentifier() { 066 return identifier; 067 } 068 069 /** 070 * Sets the value of the 'identifier' field. 071 * The Task ID of the failed Task. * @param value the value to set. 072 */ 073 public void setIdentifier(java.lang.CharSequence value) { 074 this.identifier = value; 075 } 076 077 /** 078 * Gets the value of the 'data' field. 079 * The data passed back from the Failed Task, if any. */ 080 public java.nio.ByteBuffer getData() { 081 return data; 082 } 083 084 /** 085 * Sets the value of the 'data' field. 086 * The data passed back from the Failed Task, if any. * @param value the value to set. 087 */ 088 public void setData(java.nio.ByteBuffer value) { 089 this.data = value; 090 } 091 092 /** 093 * Gets the value of the 'cause' field. 094 * The serialized Exception of that caused the Task failure. */ 095 public java.nio.ByteBuffer getCause() { 096 return cause; 097 } 098 099 /** 100 * Sets the value of the 'cause' field. 101 * The serialized Exception of that caused the Task failure. * @param value the value to set. 102 */ 103 public void setCause(java.nio.ByteBuffer value) { 104 this.cause = value; 105 } 106 107 /** 108 * Gets the value of the 'message' field. 109 * The message of the Task failure, if any. */ 110 public java.lang.CharSequence getMessage() { 111 return message; 112 } 113 114 /** 115 * Sets the value of the 'message' field. 116 * The message of the Task failure, if any. * @param value the value to set. 117 */ 118 public void setMessage(java.lang.CharSequence value) { 119 this.message = value; 120 } 121 122 /** Creates a new AvroFailedTask RecordBuilder */ 123 public static org.apache.reef.javabridge.avro.AvroFailedTask.Builder newBuilder() { 124 return new org.apache.reef.javabridge.avro.AvroFailedTask.Builder(); 125 } 126 127 /** Creates a new AvroFailedTask RecordBuilder by copying an existing Builder */ 128 public static org.apache.reef.javabridge.avro.AvroFailedTask.Builder newBuilder(org.apache.reef.javabridge.avro.AvroFailedTask.Builder other) { 129 return new org.apache.reef.javabridge.avro.AvroFailedTask.Builder(other); 130 } 131 132 /** Creates a new AvroFailedTask RecordBuilder by copying an existing AvroFailedTask instance */ 133 public static org.apache.reef.javabridge.avro.AvroFailedTask.Builder newBuilder(org.apache.reef.javabridge.avro.AvroFailedTask other) { 134 return new org.apache.reef.javabridge.avro.AvroFailedTask.Builder(other); 135 } 136 137 /** 138 * RecordBuilder for AvroFailedTask instances. 139 */ 140 public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroFailedTask> 141 implements org.apache.avro.data.RecordBuilder<AvroFailedTask> { 142 143 private java.lang.CharSequence identifier; 144 private java.nio.ByteBuffer data; 145 private java.nio.ByteBuffer cause; 146 private java.lang.CharSequence message; 147 148 /** Creates a new Builder */ 149 private Builder() { 150 super(org.apache.reef.javabridge.avro.AvroFailedTask.SCHEMA$); 151 } 152 153 /** Creates a Builder by copying an existing Builder */ 154 private Builder(org.apache.reef.javabridge.avro.AvroFailedTask.Builder other) { 155 super(other); 156 if (isValidValue(fields()[0], other.identifier)) { 157 this.identifier = data().deepCopy(fields()[0].schema(), other.identifier); 158 fieldSetFlags()[0] = true; 159 } 160 if (isValidValue(fields()[1], other.data)) { 161 this.data = data().deepCopy(fields()[1].schema(), other.data); 162 fieldSetFlags()[1] = true; 163 } 164 if (isValidValue(fields()[2], other.cause)) { 165 this.cause = data().deepCopy(fields()[2].schema(), other.cause); 166 fieldSetFlags()[2] = true; 167 } 168 if (isValidValue(fields()[3], other.message)) { 169 this.message = data().deepCopy(fields()[3].schema(), other.message); 170 fieldSetFlags()[3] = true; 171 } 172 } 173 174 /** Creates a Builder by copying an existing AvroFailedTask instance */ 175 private Builder(org.apache.reef.javabridge.avro.AvroFailedTask other) { 176 super(org.apache.reef.javabridge.avro.AvroFailedTask.SCHEMA$); 177 if (isValidValue(fields()[0], other.identifier)) { 178 this.identifier = data().deepCopy(fields()[0].schema(), other.identifier); 179 fieldSetFlags()[0] = true; 180 } 181 if (isValidValue(fields()[1], other.data)) { 182 this.data = data().deepCopy(fields()[1].schema(), other.data); 183 fieldSetFlags()[1] = true; 184 } 185 if (isValidValue(fields()[2], other.cause)) { 186 this.cause = data().deepCopy(fields()[2].schema(), other.cause); 187 fieldSetFlags()[2] = true; 188 } 189 if (isValidValue(fields()[3], other.message)) { 190 this.message = data().deepCopy(fields()[3].schema(), other.message); 191 fieldSetFlags()[3] = true; 192 } 193 } 194 195 /** Gets the value of the 'identifier' field */ 196 public java.lang.CharSequence getIdentifier() { 197 return identifier; 198 } 199 200 /** Sets the value of the 'identifier' field */ 201 public org.apache.reef.javabridge.avro.AvroFailedTask.Builder setIdentifier(java.lang.CharSequence value) { 202 validate(fields()[0], value); 203 this.identifier = value; 204 fieldSetFlags()[0] = true; 205 return this; 206 } 207 208 /** Checks whether the 'identifier' field has been set */ 209 public boolean hasIdentifier() { 210 return fieldSetFlags()[0]; 211 } 212 213 /** Clears the value of the 'identifier' field */ 214 public org.apache.reef.javabridge.avro.AvroFailedTask.Builder clearIdentifier() { 215 identifier = null; 216 fieldSetFlags()[0] = false; 217 return this; 218 } 219 220 /** Gets the value of the 'data' field */ 221 public java.nio.ByteBuffer getData() { 222 return data; 223 } 224 225 /** Sets the value of the 'data' field */ 226 public org.apache.reef.javabridge.avro.AvroFailedTask.Builder setData(java.nio.ByteBuffer value) { 227 validate(fields()[1], value); 228 this.data = value; 229 fieldSetFlags()[1] = true; 230 return this; 231 } 232 233 /** Checks whether the 'data' field has been set */ 234 public boolean hasData() { 235 return fieldSetFlags()[1]; 236 } 237 238 /** Clears the value of the 'data' field */ 239 public org.apache.reef.javabridge.avro.AvroFailedTask.Builder clearData() { 240 data = null; 241 fieldSetFlags()[1] = false; 242 return this; 243 } 244 245 /** Gets the value of the 'cause' field */ 246 public java.nio.ByteBuffer getCause() { 247 return cause; 248 } 249 250 /** Sets the value of the 'cause' field */ 251 public org.apache.reef.javabridge.avro.AvroFailedTask.Builder setCause(java.nio.ByteBuffer value) { 252 validate(fields()[2], value); 253 this.cause = value; 254 fieldSetFlags()[2] = true; 255 return this; 256 } 257 258 /** Checks whether the 'cause' field has been set */ 259 public boolean hasCause() { 260 return fieldSetFlags()[2]; 261 } 262 263 /** Clears the value of the 'cause' field */ 264 public org.apache.reef.javabridge.avro.AvroFailedTask.Builder clearCause() { 265 cause = null; 266 fieldSetFlags()[2] = false; 267 return this; 268 } 269 270 /** Gets the value of the 'message' field */ 271 public java.lang.CharSequence getMessage() { 272 return message; 273 } 274 275 /** Sets the value of the 'message' field */ 276 public org.apache.reef.javabridge.avro.AvroFailedTask.Builder setMessage(java.lang.CharSequence value) { 277 validate(fields()[3], value); 278 this.message = value; 279 fieldSetFlags()[3] = true; 280 return this; 281 } 282 283 /** Checks whether the 'message' field has been set */ 284 public boolean hasMessage() { 285 return fieldSetFlags()[3]; 286 } 287 288 /** Clears the value of the 'message' field */ 289 public org.apache.reef.javabridge.avro.AvroFailedTask.Builder clearMessage() { 290 message = null; 291 fieldSetFlags()[3] = false; 292 return this; 293 } 294 295 @Override 296 public AvroFailedTask build() { 297 try { 298 AvroFailedTask record = new AvroFailedTask(); 299 record.identifier = fieldSetFlags()[0] ? this.identifier : (java.lang.CharSequence) defaultValue(fields()[0]); 300 record.data = fieldSetFlags()[1] ? this.data : (java.nio.ByteBuffer) defaultValue(fields()[1]); 301 record.cause = fieldSetFlags()[2] ? this.cause : (java.nio.ByteBuffer) defaultValue(fields()[2]); 302 record.message = fieldSetFlags()[3] ? this.message : (java.lang.CharSequence) defaultValue(fields()[3]); 303 return record; 304 } catch (Exception e) { 305 throw new org.apache.avro.AvroRuntimeException(e); 306 } 307 } 308 } 309}