/** * Autogenerated by Avro * * DO NOT EDIT DIRECTLY */ package org.kaaproject.kaa.common.endpoint.gen; @SuppressWarnings("all") @org.apache.avro.specific.AvroGenerated public class ProtocolVersionPair 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\":\"ProtocolVersionPair\",\"namespace\":\"org.kaaproject.kaa.common.endpoint.gen\",\"fields\":[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"version\",\"type\":\"int\"}]}"); private int id; private int version; /** * Default constructor. Note that this does not initialize fields * to their default values from the schema. If that is desired then * one should use {@link \#newBuilder()}. */ public ProtocolVersionPair() { } /** * All-args constructor. */ public ProtocolVersionPair(java.lang.Integer id, java.lang.Integer version) { this.id = id; this.version = version; } public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } /** * Creates a new ProtocolVersionPair RecordBuilder */ public static org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder newBuilder() { return new org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder(); } /** * Creates a new ProtocolVersionPair RecordBuilder by copying an existing Builder */ public static org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder newBuilder(org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder other) { return new org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder(other); } /** * Creates a new ProtocolVersionPair RecordBuilder by copying an existing ProtocolVersionPair * instance */ public static org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder newBuilder(org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair other) { return new org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder(other); } 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 id; case 1: return version; 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: id = (java.lang.Integer) value$; break; case 1: version = (java.lang.Integer) value$; break; default: throw new org.apache.avro.AvroRuntimeException("Bad index"); } } /** * Gets the value of the 'id' field. */ public java.lang.Integer getId() { return id; } /** * Sets the value of the 'id' field. * * @param value the value to set. */ public void setId(java.lang.Integer value) { this.id = value; } /** * Gets the value of the 'version' field. */ public java.lang.Integer getVersion() { return version; } /** * Sets the value of the 'version' field. * * @param value the value to set. */ public void setVersion(java.lang.Integer value) { this.version = value; } /** * RecordBuilder for ProtocolVersionPair instances. */ public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<ProtocolVersionPair> implements org.apache.avro.data.RecordBuilder<ProtocolVersionPair> { private int id; private int version; /** * Creates a new Builder */ private Builder() { super(org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.SCHEMA$); } /** * Creates a Builder by copying an existing Builder */ private Builder(org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder other) { super(other); if (isValidValue(fields()[0], other.id)) { this.id = data().deepCopy(fields()[0].schema(), other.id); fieldSetFlags()[0] = true; } if (isValidValue(fields()[1], other.version)) { this.version = data().deepCopy(fields()[1].schema(), other.version); fieldSetFlags()[1] = true; } } /** * Creates a Builder by copying an existing ProtocolVersionPair instance */ private Builder(org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair other) { super(org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.SCHEMA$); if (isValidValue(fields()[0], other.id)) { this.id = data().deepCopy(fields()[0].schema(), other.id); fieldSetFlags()[0] = true; } if (isValidValue(fields()[1], other.version)) { this.version = data().deepCopy(fields()[1].schema(), other.version); fieldSetFlags()[1] = true; } } /** * Gets the value of the 'id' field */ public java.lang.Integer getId() { return id; } /** * Sets the value of the 'id' field */ public org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder setId(int value) { validate(fields()[0], value); this.id = value; fieldSetFlags()[0] = true; return this; } /** * Checks whether the 'id' field has been set */ public boolean hasId() { return fieldSetFlags()[0]; } /** * Clears the value of the 'id' field */ public org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder clearId() { fieldSetFlags()[0] = false; return this; } /** * Gets the value of the 'version' field */ public java.lang.Integer getVersion() { return version; } /** * Sets the value of the 'version' field */ public org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder setVersion(int value) { validate(fields()[1], value); this.version = value; fieldSetFlags()[1] = true; return this; } /** * Checks whether the 'version' field has been set */ public boolean hasVersion() { return fieldSetFlags()[1]; } /** * Clears the value of the 'version' field */ public org.kaaproject.kaa.common.endpoint.gen.ProtocolVersionPair.Builder clearVersion() { fieldSetFlags()[1] = false; return this; } @Override public ProtocolVersionPair build() { try { ProtocolVersionPair record = new ProtocolVersionPair(); record.id = fieldSetFlags()[0] ? this.id : (java.lang.Integer) defaultValue(fields()[0]); record.version = fieldSetFlags()[1] ? this.version : (java.lang.Integer) defaultValue(fields()[1]); return record; } catch (Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } } }