001 /**
002 * Autogenerated by Avro
003 *
004 * DO NOT EDIT DIRECTLY
005 */
006 package org.apache.hadoop.io.serializer.avro;
007 @SuppressWarnings("all")
008 @org.apache.avro.specific.AvroGenerated
009 public class AvroRecord 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\":\"AvroRecord\",\"namespace\":\"org.apache.hadoop.io.serializer.avro\",\"fields\":[{\"name\":\"intField\",\"type\":\"int\"}]}");
011 public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
012 @Deprecated public int intField;
013
014 /**
015 * Default constructor.
016 */
017 public AvroRecord() {}
018
019 /**
020 * All-args constructor.
021 */
022 public AvroRecord(java.lang.Integer intField) {
023 this.intField = intField;
024 }
025
026 public org.apache.avro.Schema getSchema() { return SCHEMA$; }
027 // Used by DatumWriter. Applications should not call.
028 public java.lang.Object get(int field$) {
029 switch (field$) {
030 case 0: return intField;
031 default: throw new org.apache.avro.AvroRuntimeException("Bad index");
032 }
033 }
034 // Used by DatumReader. Applications should not call.
035 @SuppressWarnings(value="unchecked")
036 public void put(int field$, java.lang.Object value$) {
037 switch (field$) {
038 case 0: intField = (java.lang.Integer)value$; break;
039 default: throw new org.apache.avro.AvroRuntimeException("Bad index");
040 }
041 }
042
043 /**
044 * Gets the value of the 'intField' field.
045 */
046 public java.lang.Integer getIntField() {
047 return intField;
048 }
049
050 /**
051 * Sets the value of the 'intField' field.
052 * @param value the value to set.
053 */
054 public void setIntField(java.lang.Integer value) {
055 this.intField = value;
056 }
057
058 /** Creates a new AvroRecord RecordBuilder */
059 public static org.apache.hadoop.io.serializer.avro.AvroRecord.Builder newBuilder() {
060 return new org.apache.hadoop.io.serializer.avro.AvroRecord.Builder();
061 }
062
063 /** Creates a new AvroRecord RecordBuilder by copying an existing Builder */
064 public static org.apache.hadoop.io.serializer.avro.AvroRecord.Builder newBuilder(org.apache.hadoop.io.serializer.avro.AvroRecord.Builder other) {
065 return new org.apache.hadoop.io.serializer.avro.AvroRecord.Builder(other);
066 }
067
068 /** Creates a new AvroRecord RecordBuilder by copying an existing AvroRecord instance */
069 public static org.apache.hadoop.io.serializer.avro.AvroRecord.Builder newBuilder(org.apache.hadoop.io.serializer.avro.AvroRecord other) {
070 return new org.apache.hadoop.io.serializer.avro.AvroRecord.Builder(other);
071 }
072
073 /**
074 * RecordBuilder for AvroRecord instances.
075 */
076 public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroRecord>
077 implements org.apache.avro.data.RecordBuilder<AvroRecord> {
078
079 private int intField;
080
081 /** Creates a new Builder */
082 private Builder() {
083 super(org.apache.hadoop.io.serializer.avro.AvroRecord.SCHEMA$);
084 }
085
086 /** Creates a Builder by copying an existing Builder */
087 private Builder(org.apache.hadoop.io.serializer.avro.AvroRecord.Builder other) {
088 super(other);
089 }
090
091 /** Creates a Builder by copying an existing AvroRecord instance */
092 private Builder(org.apache.hadoop.io.serializer.avro.AvroRecord other) {
093 super(org.apache.hadoop.io.serializer.avro.AvroRecord.SCHEMA$);
094 if (isValidValue(fields()[0], other.intField)) {
095 this.intField = data().deepCopy(fields()[0].schema(), other.intField);
096 fieldSetFlags()[0] = true;
097 }
098 }
099
100 /** Gets the value of the 'intField' field */
101 public java.lang.Integer getIntField() {
102 return intField;
103 }
104
105 /** Sets the value of the 'intField' field */
106 public org.apache.hadoop.io.serializer.avro.AvroRecord.Builder setIntField(int value) {
107 validate(fields()[0], value);
108 this.intField = value;
109 fieldSetFlags()[0] = true;
110 return this;
111 }
112
113 /** Checks whether the 'intField' field has been set */
114 public boolean hasIntField() {
115 return fieldSetFlags()[0];
116 }
117
118 /** Clears the value of the 'intField' field */
119 public org.apache.hadoop.io.serializer.avro.AvroRecord.Builder clearIntField() {
120 fieldSetFlags()[0] = false;
121 return this;
122 }
123
124 @Override
125 public AvroRecord build() {
126 try {
127 AvroRecord record = new AvroRecord();
128 record.intField = fieldSetFlags()[0] ? this.intField : (java.lang.Integer) defaultValue(fields()[0]);
129 return record;
130 } catch (Exception e) {
131 throw new org.apache.avro.AvroRuntimeException(e);
132 }
133 }
134 }
135 }