TMP
[demos/microservices] / validate-user / src / main / java / de / trion / microservices / avro / Order.java
diff --git a/validate-user/src/main/java/de/trion/microservices/avro/Order.java b/validate-user/src/main/java/de/trion/microservices/avro/Order.java
new file mode 100644 (file)
index 0000000..f1dc56d
--- /dev/null
@@ -0,0 +1,706 @@
+/**
+ * Autogenerated by Avro
+ *
+ * DO NOT EDIT DIRECTLY
+ */
+package de.trion.microservices.avro;
+
+import org.apache.avro.generic.GenericArray;
+import org.apache.avro.specific.SpecificData;
+import org.apache.avro.util.Utf8;
+import org.apache.avro.message.BinaryMessageEncoder;
+import org.apache.avro.message.BinaryMessageDecoder;
+import org.apache.avro.message.SchemaStore;
+
+@org.apache.avro.specific.AvroGenerated
+public class Order extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
+  private static final long serialVersionUID = 6161645617080332601L;
+  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Order\",\"namespace\":\"de.trion.microservices.avro\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"state\",\"type\":{\"type\":\"enum\",\"name\":\"OrderState\",\"symbols\":[\"CREATED\",\"APPROVED\",\"DECLINED\"],\"default\":\"CREATED\"}},{\"name\":\"customerId\",\"type\":\"long\"},{\"name\":\"orderId\",\"type\":\"long\"},{\"name\":\"productId\",\"type\":\"long\"},{\"name\":\"quantity\",\"type\":\"int\"}]}");
+  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
+
+  private static SpecificData MODEL$ = new SpecificData();
+
+  private static final BinaryMessageEncoder<Order> ENCODER =
+      new BinaryMessageEncoder<Order>(MODEL$, SCHEMA$);
+
+  private static final BinaryMessageDecoder<Order> DECODER =
+      new BinaryMessageDecoder<Order>(MODEL$, SCHEMA$);
+
+  /**
+   * Return the BinaryMessageEncoder instance used by this class.
+   * @return the message encoder used by this class
+   */
+  public static BinaryMessageEncoder<Order> getEncoder() {
+    return ENCODER;
+  }
+
+  /**
+   * Return the BinaryMessageDecoder instance used by this class.
+   * @return the message decoder used by this class
+   */
+  public static BinaryMessageDecoder<Order> getDecoder() {
+    return DECODER;
+  }
+
+  /**
+   * Create a new BinaryMessageDecoder instance for this class that uses the specified {@link SchemaStore}.
+   * @param resolver a {@link SchemaStore} used to find schemas by fingerprint
+   * @return a BinaryMessageDecoder instance for this class backed by the given SchemaStore
+   */
+  public static BinaryMessageDecoder<Order> createDecoder(SchemaStore resolver) {
+    return new BinaryMessageDecoder<Order>(MODEL$, SCHEMA$, resolver);
+  }
+
+  /**
+   * Serializes this Order to a ByteBuffer.
+   * @return a buffer holding the serialized data for this instance
+   * @throws java.io.IOException if this instance could not be serialized
+   */
+  public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException {
+    return ENCODER.encode(this);
+  }
+
+  /**
+   * Deserializes a Order from a ByteBuffer.
+   * @param b a byte buffer holding serialized data for an instance of this class
+   * @return a Order instance decoded from the given buffer
+   * @throws java.io.IOException if the given bytes could not be deserialized into an instance of this class
+   */
+  public static Order fromByteBuffer(
+      java.nio.ByteBuffer b) throws java.io.IOException {
+    return DECODER.decode(b);
+  }
+
+  @Deprecated public java.lang.CharSequence id;
+  @Deprecated public de.trion.microservices.avro.OrderState state;
+  @Deprecated public long customerId;
+  @Deprecated public long orderId;
+  @Deprecated public long productId;
+  @Deprecated public int quantity;
+
+  /**
+   * 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 Order() {}
+
+  /**
+   * All-args constructor.
+   * @param id The new value for id
+   * @param state The new value for state
+   * @param customerId The new value for customerId
+   * @param orderId The new value for orderId
+   * @param productId The new value for productId
+   * @param quantity The new value for quantity
+   */
+  public Order(java.lang.CharSequence id, de.trion.microservices.avro.OrderState state, java.lang.Long customerId, java.lang.Long orderId, java.lang.Long productId, java.lang.Integer quantity) {
+    this.id = id;
+    this.state = state;
+    this.customerId = customerId;
+    this.orderId = orderId;
+    this.productId = productId;
+    this.quantity = quantity;
+  }
+
+  public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; }
+  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 state;
+    case 2: return customerId;
+    case 3: return orderId;
+    case 4: return productId;
+    case 5: return quantity;
+    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.CharSequence)value$; break;
+    case 1: state = (de.trion.microservices.avro.OrderState)value$; break;
+    case 2: customerId = (java.lang.Long)value$; break;
+    case 3: orderId = (java.lang.Long)value$; break;
+    case 4: productId = (java.lang.Long)value$; break;
+    case 5: quantity = (java.lang.Integer)value$; break;
+    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+    }
+  }
+
+  /**
+   * Gets the value of the 'id' field.
+   * @return The value of the 'id' field.
+   */
+  public java.lang.CharSequence getId() {
+    return id;
+  }
+
+
+  /**
+   * Sets the value of the 'id' field.
+   * @param value the value to set.
+   */
+  public void setId(java.lang.CharSequence value) {
+    this.id = value;
+  }
+
+  /**
+   * Gets the value of the 'state' field.
+   * @return The value of the 'state' field.
+   */
+  public de.trion.microservices.avro.OrderState getState() {
+    return state;
+  }
+
+
+  /**
+   * Sets the value of the 'state' field.
+   * @param value the value to set.
+   */
+  public void setState(de.trion.microservices.avro.OrderState value) {
+    this.state = value;
+  }
+
+  /**
+   * Gets the value of the 'customerId' field.
+   * @return The value of the 'customerId' field.
+   */
+  public long getCustomerId() {
+    return customerId;
+  }
+
+
+  /**
+   * Sets the value of the 'customerId' field.
+   * @param value the value to set.
+   */
+  public void setCustomerId(long value) {
+    this.customerId = value;
+  }
+
+  /**
+   * Gets the value of the 'orderId' field.
+   * @return The value of the 'orderId' field.
+   */
+  public long getOrderId() {
+    return orderId;
+  }
+
+
+  /**
+   * Sets the value of the 'orderId' field.
+   * @param value the value to set.
+   */
+  public void setOrderId(long value) {
+    this.orderId = value;
+  }
+
+  /**
+   * Gets the value of the 'productId' field.
+   * @return The value of the 'productId' field.
+   */
+  public long getProductId() {
+    return productId;
+  }
+
+
+  /**
+   * Sets the value of the 'productId' field.
+   * @param value the value to set.
+   */
+  public void setProductId(long value) {
+    this.productId = value;
+  }
+
+  /**
+   * Gets the value of the 'quantity' field.
+   * @return The value of the 'quantity' field.
+   */
+  public int getQuantity() {
+    return quantity;
+  }
+
+
+  /**
+   * Sets the value of the 'quantity' field.
+   * @param value the value to set.
+   */
+  public void setQuantity(int value) {
+    this.quantity = value;
+  }
+
+  /**
+   * Creates a new Order RecordBuilder.
+   * @return A new Order RecordBuilder
+   */
+  public static de.trion.microservices.avro.Order.Builder newBuilder() {
+    return new de.trion.microservices.avro.Order.Builder();
+  }
+
+  /**
+   * Creates a new Order RecordBuilder by copying an existing Builder.
+   * @param other The existing builder to copy.
+   * @return A new Order RecordBuilder
+   */
+  public static de.trion.microservices.avro.Order.Builder newBuilder(de.trion.microservices.avro.Order.Builder other) {
+    if (other == null) {
+      return new de.trion.microservices.avro.Order.Builder();
+    } else {
+      return new de.trion.microservices.avro.Order.Builder(other);
+    }
+  }
+
+  /**
+   * Creates a new Order RecordBuilder by copying an existing Order instance.
+   * @param other The existing instance to copy.
+   * @return A new Order RecordBuilder
+   */
+  public static de.trion.microservices.avro.Order.Builder newBuilder(de.trion.microservices.avro.Order other) {
+    if (other == null) {
+      return new de.trion.microservices.avro.Order.Builder();
+    } else {
+      return new de.trion.microservices.avro.Order.Builder(other);
+    }
+  }
+
+  /**
+   * RecordBuilder for Order instances.
+   */
+  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<Order>
+    implements org.apache.avro.data.RecordBuilder<Order> {
+
+    private java.lang.CharSequence id;
+    private de.trion.microservices.avro.OrderState state;
+    private long customerId;
+    private long orderId;
+    private long productId;
+    private int quantity;
+
+    /** Creates a new Builder */
+    private Builder() {
+      super(SCHEMA$);
+    }
+
+    /**
+     * Creates a Builder by copying an existing Builder.
+     * @param other The existing Builder to copy.
+     */
+    private Builder(de.trion.microservices.avro.Order.Builder other) {
+      super(other);
+      if (isValidValue(fields()[0], other.id)) {
+        this.id = data().deepCopy(fields()[0].schema(), other.id);
+        fieldSetFlags()[0] = other.fieldSetFlags()[0];
+      }
+      if (isValidValue(fields()[1], other.state)) {
+        this.state = data().deepCopy(fields()[1].schema(), other.state);
+        fieldSetFlags()[1] = other.fieldSetFlags()[1];
+      }
+      if (isValidValue(fields()[2], other.customerId)) {
+        this.customerId = data().deepCopy(fields()[2].schema(), other.customerId);
+        fieldSetFlags()[2] = other.fieldSetFlags()[2];
+      }
+      if (isValidValue(fields()[3], other.orderId)) {
+        this.orderId = data().deepCopy(fields()[3].schema(), other.orderId);
+        fieldSetFlags()[3] = other.fieldSetFlags()[3];
+      }
+      if (isValidValue(fields()[4], other.productId)) {
+        this.productId = data().deepCopy(fields()[4].schema(), other.productId);
+        fieldSetFlags()[4] = other.fieldSetFlags()[4];
+      }
+      if (isValidValue(fields()[5], other.quantity)) {
+        this.quantity = data().deepCopy(fields()[5].schema(), other.quantity);
+        fieldSetFlags()[5] = other.fieldSetFlags()[5];
+      }
+    }
+
+    /**
+     * Creates a Builder by copying an existing Order instance
+     * @param other The existing instance to copy.
+     */
+    private Builder(de.trion.microservices.avro.Order other) {
+      super(SCHEMA$);
+      if (isValidValue(fields()[0], other.id)) {
+        this.id = data().deepCopy(fields()[0].schema(), other.id);
+        fieldSetFlags()[0] = true;
+      }
+      if (isValidValue(fields()[1], other.state)) {
+        this.state = data().deepCopy(fields()[1].schema(), other.state);
+        fieldSetFlags()[1] = true;
+      }
+      if (isValidValue(fields()[2], other.customerId)) {
+        this.customerId = data().deepCopy(fields()[2].schema(), other.customerId);
+        fieldSetFlags()[2] = true;
+      }
+      if (isValidValue(fields()[3], other.orderId)) {
+        this.orderId = data().deepCopy(fields()[3].schema(), other.orderId);
+        fieldSetFlags()[3] = true;
+      }
+      if (isValidValue(fields()[4], other.productId)) {
+        this.productId = data().deepCopy(fields()[4].schema(), other.productId);
+        fieldSetFlags()[4] = true;
+      }
+      if (isValidValue(fields()[5], other.quantity)) {
+        this.quantity = data().deepCopy(fields()[5].schema(), other.quantity);
+        fieldSetFlags()[5] = true;
+      }
+    }
+
+    /**
+      * Gets the value of the 'id' field.
+      * @return The value.
+      */
+    public java.lang.CharSequence getId() {
+      return id;
+    }
+
+
+    /**
+      * Sets the value of the 'id' field.
+      * @param value The value of 'id'.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.Order.Builder setId(java.lang.CharSequence value) {
+      validate(fields()[0], value);
+      this.id = value;
+      fieldSetFlags()[0] = true;
+      return this;
+    }
+
+    /**
+      * Checks whether the 'id' field has been set.
+      * @return True if the 'id' field has been set, false otherwise.
+      */
+    public boolean hasId() {
+      return fieldSetFlags()[0];
+    }
+
+
+    /**
+      * Clears the value of the 'id' field.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.Order.Builder clearId() {
+      id = null;
+      fieldSetFlags()[0] = false;
+      return this;
+    }
+
+    /**
+      * Gets the value of the 'state' field.
+      * @return The value.
+      */
+    public de.trion.microservices.avro.OrderState getState() {
+      return state;
+    }
+
+
+    /**
+      * Sets the value of the 'state' field.
+      * @param value The value of 'state'.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.Order.Builder setState(de.trion.microservices.avro.OrderState value) {
+      validate(fields()[1], value);
+      this.state = value;
+      fieldSetFlags()[1] = true;
+      return this;
+    }
+
+    /**
+      * Checks whether the 'state' field has been set.
+      * @return True if the 'state' field has been set, false otherwise.
+      */
+    public boolean hasState() {
+      return fieldSetFlags()[1];
+    }
+
+
+    /**
+      * Clears the value of the 'state' field.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.Order.Builder clearState() {
+      state = null;
+      fieldSetFlags()[1] = false;
+      return this;
+    }
+
+    /**
+      * Gets the value of the 'customerId' field.
+      * @return The value.
+      */
+    public long getCustomerId() {
+      return customerId;
+    }
+
+
+    /**
+      * Sets the value of the 'customerId' field.
+      * @param value The value of 'customerId'.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.Order.Builder setCustomerId(long value) {
+      validate(fields()[2], value);
+      this.customerId = value;
+      fieldSetFlags()[2] = true;
+      return this;
+    }
+
+    /**
+      * Checks whether the 'customerId' field has been set.
+      * @return True if the 'customerId' field has been set, false otherwise.
+      */
+    public boolean hasCustomerId() {
+      return fieldSetFlags()[2];
+    }
+
+
+    /**
+      * Clears the value of the 'customerId' field.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.Order.Builder clearCustomerId() {
+      fieldSetFlags()[2] = false;
+      return this;
+    }
+
+    /**
+      * Gets the value of the 'orderId' field.
+      * @return The value.
+      */
+    public long getOrderId() {
+      return orderId;
+    }
+
+
+    /**
+      * Sets the value of the 'orderId' field.
+      * @param value The value of 'orderId'.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.Order.Builder setOrderId(long value) {
+      validate(fields()[3], value);
+      this.orderId = value;
+      fieldSetFlags()[3] = true;
+      return this;
+    }
+
+    /**
+      * Checks whether the 'orderId' field has been set.
+      * @return True if the 'orderId' field has been set, false otherwise.
+      */
+    public boolean hasOrderId() {
+      return fieldSetFlags()[3];
+    }
+
+
+    /**
+      * Clears the value of the 'orderId' field.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.Order.Builder clearOrderId() {
+      fieldSetFlags()[3] = false;
+      return this;
+    }
+
+    /**
+      * Gets the value of the 'productId' field.
+      * @return The value.
+      */
+    public long getProductId() {
+      return productId;
+    }
+
+
+    /**
+      * Sets the value of the 'productId' field.
+      * @param value The value of 'productId'.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.Order.Builder setProductId(long value) {
+      validate(fields()[4], value);
+      this.productId = value;
+      fieldSetFlags()[4] = true;
+      return this;
+    }
+
+    /**
+      * Checks whether the 'productId' field has been set.
+      * @return True if the 'productId' field has been set, false otherwise.
+      */
+    public boolean hasProductId() {
+      return fieldSetFlags()[4];
+    }
+
+
+    /**
+      * Clears the value of the 'productId' field.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.Order.Builder clearProductId() {
+      fieldSetFlags()[4] = false;
+      return this;
+    }
+
+    /**
+      * Gets the value of the 'quantity' field.
+      * @return The value.
+      */
+    public int getQuantity() {
+      return quantity;
+    }
+
+
+    /**
+      * Sets the value of the 'quantity' field.
+      * @param value The value of 'quantity'.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.Order.Builder setQuantity(int value) {
+      validate(fields()[5], value);
+      this.quantity = value;
+      fieldSetFlags()[5] = true;
+      return this;
+    }
+
+    /**
+      * Checks whether the 'quantity' field has been set.
+      * @return True if the 'quantity' field has been set, false otherwise.
+      */
+    public boolean hasQuantity() {
+      return fieldSetFlags()[5];
+    }
+
+
+    /**
+      * Clears the value of the 'quantity' field.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.Order.Builder clearQuantity() {
+      fieldSetFlags()[5] = false;
+      return this;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public Order build() {
+      try {
+        Order record = new Order();
+        record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]);
+        record.state = fieldSetFlags()[1] ? this.state : (de.trion.microservices.avro.OrderState) defaultValue(fields()[1]);
+        record.customerId = fieldSetFlags()[2] ? this.customerId : (java.lang.Long) defaultValue(fields()[2]);
+        record.orderId = fieldSetFlags()[3] ? this.orderId : (java.lang.Long) defaultValue(fields()[3]);
+        record.productId = fieldSetFlags()[4] ? this.productId : (java.lang.Long) defaultValue(fields()[4]);
+        record.quantity = fieldSetFlags()[5] ? this.quantity : (java.lang.Integer) defaultValue(fields()[5]);
+        return record;
+      } catch (org.apache.avro.AvroMissingFieldException e) {
+        throw e;
+      } catch (java.lang.Exception e) {
+        throw new org.apache.avro.AvroRuntimeException(e);
+      }
+    }
+  }
+
+  @SuppressWarnings("unchecked")
+  private static final org.apache.avro.io.DatumWriter<Order>
+    WRITER$ = (org.apache.avro.io.DatumWriter<Order>)MODEL$.createDatumWriter(SCHEMA$);
+
+  @Override public void writeExternal(java.io.ObjectOutput out)
+    throws java.io.IOException {
+    WRITER$.write(this, SpecificData.getEncoder(out));
+  }
+
+  @SuppressWarnings("unchecked")
+  private static final org.apache.avro.io.DatumReader<Order>
+    READER$ = (org.apache.avro.io.DatumReader<Order>)MODEL$.createDatumReader(SCHEMA$);
+
+  @Override public void readExternal(java.io.ObjectInput in)
+    throws java.io.IOException {
+    READER$.read(this, SpecificData.getDecoder(in));
+  }
+
+  @Override protected boolean hasCustomCoders() { return true; }
+
+  @Override public void customEncode(org.apache.avro.io.Encoder out)
+    throws java.io.IOException
+  {
+    out.writeString(this.id);
+
+    out.writeEnum(this.state.ordinal());
+
+    out.writeLong(this.customerId);
+
+    out.writeLong(this.orderId);
+
+    out.writeLong(this.productId);
+
+    out.writeInt(this.quantity);
+
+  }
+
+  @Override public void customDecode(org.apache.avro.io.ResolvingDecoder in)
+    throws java.io.IOException
+  {
+    org.apache.avro.Schema.Field[] fieldOrder = in.readFieldOrderIfDiff();
+    if (fieldOrder == null) {
+      this.id = in.readString(this.id instanceof Utf8 ? (Utf8)this.id : null);
+
+      this.state = de.trion.microservices.avro.OrderState.values()[in.readEnum()];
+
+      this.customerId = in.readLong();
+
+      this.orderId = in.readLong();
+
+      this.productId = in.readLong();
+
+      this.quantity = in.readInt();
+
+    } else {
+      for (int i = 0; i < 6; i++) {
+        switch (fieldOrder[i].pos()) {
+        case 0:
+          this.id = in.readString(this.id instanceof Utf8 ? (Utf8)this.id : null);
+          break;
+
+        case 1:
+          this.state = de.trion.microservices.avro.OrderState.values()[in.readEnum()];
+          break;
+
+        case 2:
+          this.customerId = in.readLong();
+          break;
+
+        case 3:
+          this.orderId = in.readLong();
+          break;
+
+        case 4:
+          this.productId = in.readLong();
+          break;
+
+        case 5:
+          this.quantity = in.readInt();
+          break;
+
+        default:
+          throw new java.io.IOException("Corrupt ResolvingDecoder.");
+        }
+      }
+    }
+  }
+}
+
+
+
+
+
+
+
+
+
+