/** * Autogenerated by Avro * * DO NOT EDIT DIRECTLY */ package org.kaaproject.kaa.common.endpoint.gen; @SuppressWarnings("all") @org.apache.avro.specific.AvroGenerated public class SubscriptionCommand 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\":\"SubscriptionCommand\",\"namespace\":\"org.kaaproject.kaa.common.endpoint.gen\",\"fields\":[{\"name\":\"topicId\",\"type\":\"long\"},{\"name\":\"command\",\"type\":{\"type\":\"enum\",\"name\":\"SubscriptionCommandType\",\"symbols\":[\"ADD\",\"REMOVE\"]}}],\"direction\":\"out\"}"); private long topicId; private org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommandType command; /** * 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 SubscriptionCommand() { } /** * All-args constructor. */ public SubscriptionCommand(java.lang.Long topicId, org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommandType command) { this.topicId = topicId; this.command = command; } public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } /** * Creates a new SubscriptionCommand RecordBuilder */ public static org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommand.Builder newBuilder() { return new org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommand.Builder(); } /** * Creates a new SubscriptionCommand RecordBuilder by copying an existing Builder */ public static org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommand.Builder newBuilder(org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommand.Builder other) { return new org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommand.Builder(other); } /** * Creates a new SubscriptionCommand RecordBuilder by copying an existing SubscriptionCommand * instance */ public static org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommand.Builder newBuilder(org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommand other) { return new org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommand.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 topicId; case 1: return command; 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: topicId = (java.lang.Long) value$; break; case 1: command = (org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommandType) value$; break; default: throw new org.apache.avro.AvroRuntimeException("Bad index"); } } /** * Gets the value of the 'topicId' field. */ public java.lang.Long getTopicId() { return topicId; } /** * Sets the value of the 'topicId' field. * * @param value the value to set. */ public void setTopicId(java.lang.Long value) { this.topicId = value; } /** * Gets the value of the 'command' field. */ public org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommandType getCommand() { return command; } /** * Sets the value of the 'command' field. * * @param value the value to set. */ public void setCommand(org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommandType value) { this.command = value; } /** * RecordBuilder for SubscriptionCommand instances. */ public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<SubscriptionCommand> implements org.apache.avro.data.RecordBuilder<SubscriptionCommand> { private long topicId; private org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommandType command; /** * Creates a new Builder */ private Builder() { super(org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommand.SCHEMA$); } /** * Creates a Builder by copying an existing Builder */ private Builder(org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommand.Builder other) { super(other); if (isValidValue(fields()[0], other.topicId)) { this.topicId = data().deepCopy(fields()[0].schema(), other.topicId); fieldSetFlags()[0] = true; } if (isValidValue(fields()[1], other.command)) { this.command = data().deepCopy(fields()[1].schema(), other.command); fieldSetFlags()[1] = true; } } /** * Creates a Builder by copying an existing SubscriptionCommand instance */ private Builder(org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommand other) { super(org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommand.SCHEMA$); if (isValidValue(fields()[0], other.topicId)) { this.topicId = data().deepCopy(fields()[0].schema(), other.topicId); fieldSetFlags()[0] = true; } if (isValidValue(fields()[1], other.command)) { this.command = data().deepCopy(fields()[1].schema(), other.command); fieldSetFlags()[1] = true; } } /** * Gets the value of the 'topicId' field */ public java.lang.Long getTopicId() { return topicId; } /** * Sets the value of the 'topicId' field */ public org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommand.Builder setTopicId(long value) { validate(fields()[0], value); this.topicId = value; fieldSetFlags()[0] = true; return this; } /** * Checks whether the 'topicId' field has been set */ public boolean hasTopicId() { return fieldSetFlags()[0]; } /** * Clears the value of the 'topicId' field */ public org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommand.Builder clearTopicId() { fieldSetFlags()[0] = false; return this; } /** * Gets the value of the 'command' field */ public org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommandType getCommand() { return command; } /** * Sets the value of the 'command' field */ public org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommand.Builder setCommand(org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommandType value) { validate(fields()[1], value); this.command = value; fieldSetFlags()[1] = true; return this; } /** * Checks whether the 'command' field has been set */ public boolean hasCommand() { return fieldSetFlags()[1]; } /** * Clears the value of the 'command' field */ public org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommand.Builder clearCommand() { command = null; fieldSetFlags()[1] = false; return this; } @Override public SubscriptionCommand build() { try { SubscriptionCommand record = new SubscriptionCommand(); record.topicId = fieldSetFlags()[0] ? this.topicId : (java.lang.Long) defaultValue(fields()[0]); record.command = fieldSetFlags()[1] ? this.command : (org.kaaproject.kaa.common.endpoint.gen.SubscriptionCommandType) defaultValue(fields()[1]); return record; } catch (Exception e) { throw new org.apache.avro.AvroRuntimeException(e); } } } }