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