/**
* Autogenerated by Avro
*
* DO NOT EDIT DIRECTLY
*/
package avro.complex_schema;
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class value extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"value\",\"namespace\":\"avro.complex_schema\",\"fields\":[{\"name\":\"value\",\"type\":[{\"type\":\"bytes\",\"logicalType\":\"decimal\",\"scale\":0,\"precision\":34},\"null\"],\"doc\":\"Simple type {http://www.w3.org/2001/XMLSchema}decimal\"}]}");
public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
/** Simple type {http://www.w3.org/2001/XMLSchema}decimal */
@Deprecated public java.nio.ByteBuffer value;
/**
* Default constructor. Note that this does not initialize fields
* to their default values from the schema. If that is desired then
* one should use <code>newBuilder()</code>.
*/
public value() {}
/**
* All-args constructor.
*/
public value(java.nio.ByteBuffer value) {
this.value = value;
}
public org.apache.avro.Schema getSchema() { return SCHEMA$; }
// Used by DatumWriter. Applications should not call.
public java.lang.Object get(int field$) {
switch (field$) {
case 0: return value;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
// Used by DatumReader. Applications should not call.
@SuppressWarnings(value="unchecked")
public void put(int field$, java.lang.Object value$) {
switch (field$) {
case 0: value = (java.nio.ByteBuffer)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index");
}
}
/**
* Gets the value of the 'value' field.
* Simple type {http://www.w3.org/2001/XMLSchema}decimal */
public java.nio.ByteBuffer getValue() {
return value;
}
/**
* Sets the value of the 'value' field.
* Simple type {http://www.w3.org/2001/XMLSchema}decimal * @param value the value to set.
*/
public void setValue(java.nio.ByteBuffer value) {
this.value = value;
}
/** Creates a new value RecordBuilder */
public static avro.complex_schema.value.Builder newBuilder() {
return new avro.complex_schema.value.Builder();
}
/** Creates a new value RecordBuilder by copying an existing Builder */
public static avro.complex_schema.value.Builder newBuilder(avro.complex_schema.value.Builder other) {
return new avro.complex_schema.value.Builder(other);
}
/** Creates a new value RecordBuilder by copying an existing value instance */
public static avro.complex_schema.value.Builder newBuilder(avro.complex_schema.value other) {
return new avro.complex_schema.value.Builder(other);
}
/**
* RecordBuilder for value instances.
*/
public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<value>
implements org.apache.avro.data.RecordBuilder<value> {
private java.nio.ByteBuffer value;
/** Creates a new Builder */
private Builder() {
super(avro.complex_schema.value.SCHEMA$);
}
/** Creates a Builder by copying an existing Builder */
private Builder(avro.complex_schema.value.Builder other) {
super(other);
if (isValidValue(fields()[0], other.value)) {
this.value = data().deepCopy(fields()[0].schema(), other.value);
fieldSetFlags()[0] = true;
}
}
/** Creates a Builder by copying an existing value instance */
private Builder(avro.complex_schema.value other) {
super(avro.complex_schema.value.SCHEMA$);
if (isValidValue(fields()[0], other.value)) {
this.value = data().deepCopy(fields()[0].schema(), other.value);
fieldSetFlags()[0] = true;
}
}
/** Gets the value of the 'value' field */
public java.nio.ByteBuffer getValue() {
return value;
}
/** Sets the value of the 'value' field */
public avro.complex_schema.value.Builder setValue(java.nio.ByteBuffer value) {
validate(fields()[0], value);
this.value = value;
fieldSetFlags()[0] = true;
return this;
}
/** Checks whether the 'value' field has been set */
public boolean hasValue() {
return fieldSetFlags()[0];
}
/** Clears the value of the 'value' field */
public avro.complex_schema.value.Builder clearValue() {
value = null;
fieldSetFlags()[0] = false;
return this;
}
@Override
public value build() {
try {
value record = new value();
record.value = fieldSetFlags()[0] ? this.value : (java.nio.ByteBuffer) defaultValue(fields()[0]);
return record;
} catch (Exception e) {
throw new org.apache.avro.AvroRuntimeException(e);
}
}
}
}