001/** 002 * Autogenerated by Avro 003 * 004 * DO NOT EDIT DIRECTLY 005 */ 006package org.apache.reef.io.watcher.wake.time.runtime.event; 007@SuppressWarnings("all") 008@org.apache.avro.specific.AvroGenerated 009public class AvroRuntimeStop 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\":\"AvroRuntimeStop\",\"namespace\":\"org.apache.reef.io.watcher.wake.time.runtime.event\",\"fields\":[{\"name\":\"timestamp\",\"type\":\"long\"},{\"name\":\"exception\",\"type\":[\"string\",\"null\"]}]}"); 011 public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } 012 @Deprecated public long timestamp; 013 @Deprecated public java.lang.CharSequence exception; 014 015 /** 016 * Default constructor. Note that this does not initialize fields 017 * to their default values from the schema. If that is desired then 018 * one should use <code>newBuilder()</code>. 019 */ 020 public AvroRuntimeStop() {} 021 022 /** 023 * All-args constructor. 024 */ 025 public AvroRuntimeStop(java.lang.Long timestamp, java.lang.CharSequence exception) { 026 this.timestamp = timestamp; 027 this.exception = exception; 028 } 029 030 public org.apache.avro.Schema getSchema() { return SCHEMA$; } 031 // Used by DatumWriter. Applications should not call. 032 public java.lang.Object get(int field$) { 033 switch (field$) { 034 case 0: return timestamp; 035 case 1: return exception; 036 default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 037 } 038 } 039 // Used by DatumReader. Applications should not call. 040 @SuppressWarnings(value="unchecked") 041 public void put(int field$, java.lang.Object value$) { 042 switch (field$) { 043 case 0: timestamp = (java.lang.Long)value$; break; 044 case 1: exception = (java.lang.CharSequence)value$; break; 045 default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 046 } 047 } 048 049 /** 050 * Gets the value of the 'timestamp' field. 051 */ 052 public java.lang.Long getTimestamp() { 053 return timestamp; 054 } 055 056 /** 057 * Sets the value of the 'timestamp' field. 058 * @param value the value to set. 059 */ 060 public void setTimestamp(java.lang.Long value) { 061 this.timestamp = value; 062 } 063 064 /** 065 * Gets the value of the 'exception' field. 066 */ 067 public java.lang.CharSequence getException() { 068 return exception; 069 } 070 071 /** 072 * Sets the value of the 'exception' field. 073 * @param value the value to set. 074 */ 075 public void setException(java.lang.CharSequence value) { 076 this.exception = value; 077 } 078 079 /** Creates a new AvroRuntimeStop RecordBuilder */ 080 public static org.apache.reef.io.watcher.wake.time.runtime.event.AvroRuntimeStop.Builder newBuilder() { 081 return new org.apache.reef.io.watcher.wake.time.runtime.event.AvroRuntimeStop.Builder(); 082 } 083 084 /** Creates a new AvroRuntimeStop RecordBuilder by copying an existing Builder */ 085 public static org.apache.reef.io.watcher.wake.time.runtime.event.AvroRuntimeStop.Builder newBuilder(org.apache.reef.io.watcher.wake.time.runtime.event.AvroRuntimeStop.Builder other) { 086 return new org.apache.reef.io.watcher.wake.time.runtime.event.AvroRuntimeStop.Builder(other); 087 } 088 089 /** Creates a new AvroRuntimeStop RecordBuilder by copying an existing AvroRuntimeStop instance */ 090 public static org.apache.reef.io.watcher.wake.time.runtime.event.AvroRuntimeStop.Builder newBuilder(org.apache.reef.io.watcher.wake.time.runtime.event.AvroRuntimeStop other) { 091 return new org.apache.reef.io.watcher.wake.time.runtime.event.AvroRuntimeStop.Builder(other); 092 } 093 094 /** 095 * RecordBuilder for AvroRuntimeStop instances. 096 */ 097 public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroRuntimeStop> 098 implements org.apache.avro.data.RecordBuilder<AvroRuntimeStop> { 099 100 private long timestamp; 101 private java.lang.CharSequence exception; 102 103 /** Creates a new Builder */ 104 private Builder() { 105 super(org.apache.reef.io.watcher.wake.time.runtime.event.AvroRuntimeStop.SCHEMA$); 106 } 107 108 /** Creates a Builder by copying an existing Builder */ 109 private Builder(org.apache.reef.io.watcher.wake.time.runtime.event.AvroRuntimeStop.Builder other) { 110 super(other); 111 if (isValidValue(fields()[0], other.timestamp)) { 112 this.timestamp = data().deepCopy(fields()[0].schema(), other.timestamp); 113 fieldSetFlags()[0] = true; 114 } 115 if (isValidValue(fields()[1], other.exception)) { 116 this.exception = data().deepCopy(fields()[1].schema(), other.exception); 117 fieldSetFlags()[1] = true; 118 } 119 } 120 121 /** Creates a Builder by copying an existing AvroRuntimeStop instance */ 122 private Builder(org.apache.reef.io.watcher.wake.time.runtime.event.AvroRuntimeStop other) { 123 super(org.apache.reef.io.watcher.wake.time.runtime.event.AvroRuntimeStop.SCHEMA$); 124 if (isValidValue(fields()[0], other.timestamp)) { 125 this.timestamp = data().deepCopy(fields()[0].schema(), other.timestamp); 126 fieldSetFlags()[0] = true; 127 } 128 if (isValidValue(fields()[1], other.exception)) { 129 this.exception = data().deepCopy(fields()[1].schema(), other.exception); 130 fieldSetFlags()[1] = true; 131 } 132 } 133 134 /** Gets the value of the 'timestamp' field */ 135 public java.lang.Long getTimestamp() { 136 return timestamp; 137 } 138 139 /** Sets the value of the 'timestamp' field */ 140 public org.apache.reef.io.watcher.wake.time.runtime.event.AvroRuntimeStop.Builder setTimestamp(long value) { 141 validate(fields()[0], value); 142 this.timestamp = value; 143 fieldSetFlags()[0] = true; 144 return this; 145 } 146 147 /** Checks whether the 'timestamp' field has been set */ 148 public boolean hasTimestamp() { 149 return fieldSetFlags()[0]; 150 } 151 152 /** Clears the value of the 'timestamp' field */ 153 public org.apache.reef.io.watcher.wake.time.runtime.event.AvroRuntimeStop.Builder clearTimestamp() { 154 fieldSetFlags()[0] = false; 155 return this; 156 } 157 158 /** Gets the value of the 'exception' field */ 159 public java.lang.CharSequence getException() { 160 return exception; 161 } 162 163 /** Sets the value of the 'exception' field */ 164 public org.apache.reef.io.watcher.wake.time.runtime.event.AvroRuntimeStop.Builder setException(java.lang.CharSequence value) { 165 validate(fields()[1], value); 166 this.exception = value; 167 fieldSetFlags()[1] = true; 168 return this; 169 } 170 171 /** Checks whether the 'exception' field has been set */ 172 public boolean hasException() { 173 return fieldSetFlags()[1]; 174 } 175 176 /** Clears the value of the 'exception' field */ 177 public org.apache.reef.io.watcher.wake.time.runtime.event.AvroRuntimeStop.Builder clearException() { 178 exception = null; 179 fieldSetFlags()[1] = false; 180 return this; 181 } 182 183 @Override 184 public AvroRuntimeStop build() { 185 try { 186 AvroRuntimeStop record = new AvroRuntimeStop(); 187 record.timestamp = fieldSetFlags()[0] ? this.timestamp : (java.lang.Long) defaultValue(fields()[0]); 188 record.exception = fieldSetFlags()[1] ? this.exception : (java.lang.CharSequence) defaultValue(fields()[1]); 189 return record; 190 } catch (Exception e) { 191 throw new org.apache.avro.AvroRuntimeException(e); 192 } 193 } 194 } 195}