TMP
[demos/microservices] / validate-user / src / main / java / de / trion / microservices / avro / OrderValidation.java
diff --git a/validate-user/src/main/java/de/trion/microservices/avro/OrderValidation.java b/validate-user/src/main/java/de/trion/microservices/avro/OrderValidation.java
new file mode 100644 (file)
index 0000000..c15f3af
--- /dev/null
@@ -0,0 +1,587 @@
+/**
+ * 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 OrderValidation extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
+  private static final long serialVersionUID = 8233123483892962178L;
+  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"OrderValidation\",\"namespace\":\"de.trion.microservices.avro\",\"fields\":[{\"name\":\"orderId\",\"type\":\"string\"},{\"name\":\"checkType\",\"type\":{\"type\":\"enum\",\"name\":\"OrderValidationType\",\"symbols\":[\"ORDER_DETAILS_CHECK\",\"ORDER_USER_CHECK\"]}},{\"name\":\"validationResult\",\"type\":{\"type\":\"enum\",\"name\":\"OrderValidationResult\",\"symbols\":[\"PASS\",\"FAIL\"]}},{\"name\":\"messages\",\"type\":{\"type\":\"array\",\"items\":\"string\"}}]}");
+  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
+
+  private static SpecificData MODEL$ = new SpecificData();
+
+  private static final BinaryMessageEncoder<OrderValidation> ENCODER =
+      new BinaryMessageEncoder<OrderValidation>(MODEL$, SCHEMA$);
+
+  private static final BinaryMessageDecoder<OrderValidation> DECODER =
+      new BinaryMessageDecoder<OrderValidation>(MODEL$, SCHEMA$);
+
+  /**
+   * Return the BinaryMessageEncoder instance used by this class.
+   * @return the message encoder used by this class
+   */
+  public static BinaryMessageEncoder<OrderValidation> getEncoder() {
+    return ENCODER;
+  }
+
+  /**
+   * Return the BinaryMessageDecoder instance used by this class.
+   * @return the message decoder used by this class
+   */
+  public static BinaryMessageDecoder<OrderValidation> 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<OrderValidation> createDecoder(SchemaStore resolver) {
+    return new BinaryMessageDecoder<OrderValidation>(MODEL$, SCHEMA$, resolver);
+  }
+
+  /**
+   * Serializes this OrderValidation 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 OrderValidation from a ByteBuffer.
+   * @param b a byte buffer holding serialized data for an instance of this class
+   * @return a OrderValidation 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 OrderValidation fromByteBuffer(
+      java.nio.ByteBuffer b) throws java.io.IOException {
+    return DECODER.decode(b);
+  }
+
+  @Deprecated public java.lang.CharSequence orderId;
+  @Deprecated public de.trion.microservices.avro.OrderValidationType checkType;
+  @Deprecated public de.trion.microservices.avro.OrderValidationResult validationResult;
+  @Deprecated public java.util.List<java.lang.CharSequence> messages;
+
+  /**
+   * 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 OrderValidation() {}
+
+  /**
+   * All-args constructor.
+   * @param orderId The new value for orderId
+   * @param checkType The new value for checkType
+   * @param validationResult The new value for validationResult
+   * @param messages The new value for messages
+   */
+  public OrderValidation(java.lang.CharSequence orderId, de.trion.microservices.avro.OrderValidationType checkType, de.trion.microservices.avro.OrderValidationResult validationResult, java.util.List<java.lang.CharSequence> messages) {
+    this.orderId = orderId;
+    this.checkType = checkType;
+    this.validationResult = validationResult;
+    this.messages = messages;
+  }
+
+  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 orderId;
+    case 1: return checkType;
+    case 2: return validationResult;
+    case 3: return messages;
+    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: orderId = (java.lang.CharSequence)value$; break;
+    case 1: checkType = (de.trion.microservices.avro.OrderValidationType)value$; break;
+    case 2: validationResult = (de.trion.microservices.avro.OrderValidationResult)value$; break;
+    case 3: messages = (java.util.List<java.lang.CharSequence>)value$; break;
+    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
+    }
+  }
+
+  /**
+   * Gets the value of the 'orderId' field.
+   * @return The value of the 'orderId' field.
+   */
+  public java.lang.CharSequence getOrderId() {
+    return orderId;
+  }
+
+
+  /**
+   * Sets the value of the 'orderId' field.
+   * @param value the value to set.
+   */
+  public void setOrderId(java.lang.CharSequence value) {
+    this.orderId = value;
+  }
+
+  /**
+   * Gets the value of the 'checkType' field.
+   * @return The value of the 'checkType' field.
+   */
+  public de.trion.microservices.avro.OrderValidationType getCheckType() {
+    return checkType;
+  }
+
+
+  /**
+   * Sets the value of the 'checkType' field.
+   * @param value the value to set.
+   */
+  public void setCheckType(de.trion.microservices.avro.OrderValidationType value) {
+    this.checkType = value;
+  }
+
+  /**
+   * Gets the value of the 'validationResult' field.
+   * @return The value of the 'validationResult' field.
+   */
+  public de.trion.microservices.avro.OrderValidationResult getValidationResult() {
+    return validationResult;
+  }
+
+
+  /**
+   * Sets the value of the 'validationResult' field.
+   * @param value the value to set.
+   */
+  public void setValidationResult(de.trion.microservices.avro.OrderValidationResult value) {
+    this.validationResult = value;
+  }
+
+  /**
+   * Gets the value of the 'messages' field.
+   * @return The value of the 'messages' field.
+   */
+  public java.util.List<java.lang.CharSequence> getMessages() {
+    return messages;
+  }
+
+
+  /**
+   * Sets the value of the 'messages' field.
+   * @param value the value to set.
+   */
+  public void setMessages(java.util.List<java.lang.CharSequence> value) {
+    this.messages = value;
+  }
+
+  /**
+   * Creates a new OrderValidation RecordBuilder.
+   * @return A new OrderValidation RecordBuilder
+   */
+  public static de.trion.microservices.avro.OrderValidation.Builder newBuilder() {
+    return new de.trion.microservices.avro.OrderValidation.Builder();
+  }
+
+  /**
+   * Creates a new OrderValidation RecordBuilder by copying an existing Builder.
+   * @param other The existing builder to copy.
+   * @return A new OrderValidation RecordBuilder
+   */
+  public static de.trion.microservices.avro.OrderValidation.Builder newBuilder(de.trion.microservices.avro.OrderValidation.Builder other) {
+    if (other == null) {
+      return new de.trion.microservices.avro.OrderValidation.Builder();
+    } else {
+      return new de.trion.microservices.avro.OrderValidation.Builder(other);
+    }
+  }
+
+  /**
+   * Creates a new OrderValidation RecordBuilder by copying an existing OrderValidation instance.
+   * @param other The existing instance to copy.
+   * @return A new OrderValidation RecordBuilder
+   */
+  public static de.trion.microservices.avro.OrderValidation.Builder newBuilder(de.trion.microservices.avro.OrderValidation other) {
+    if (other == null) {
+      return new de.trion.microservices.avro.OrderValidation.Builder();
+    } else {
+      return new de.trion.microservices.avro.OrderValidation.Builder(other);
+    }
+  }
+
+  /**
+   * RecordBuilder for OrderValidation instances.
+   */
+  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<OrderValidation>
+    implements org.apache.avro.data.RecordBuilder<OrderValidation> {
+
+    private java.lang.CharSequence orderId;
+    private de.trion.microservices.avro.OrderValidationType checkType;
+    private de.trion.microservices.avro.OrderValidationResult validationResult;
+    private java.util.List<java.lang.CharSequence> messages;
+
+    /** 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.OrderValidation.Builder other) {
+      super(other);
+      if (isValidValue(fields()[0], other.orderId)) {
+        this.orderId = data().deepCopy(fields()[0].schema(), other.orderId);
+        fieldSetFlags()[0] = other.fieldSetFlags()[0];
+      }
+      if (isValidValue(fields()[1], other.checkType)) {
+        this.checkType = data().deepCopy(fields()[1].schema(), other.checkType);
+        fieldSetFlags()[1] = other.fieldSetFlags()[1];
+      }
+      if (isValidValue(fields()[2], other.validationResult)) {
+        this.validationResult = data().deepCopy(fields()[2].schema(), other.validationResult);
+        fieldSetFlags()[2] = other.fieldSetFlags()[2];
+      }
+      if (isValidValue(fields()[3], other.messages)) {
+        this.messages = data().deepCopy(fields()[3].schema(), other.messages);
+        fieldSetFlags()[3] = other.fieldSetFlags()[3];
+      }
+    }
+
+    /**
+     * Creates a Builder by copying an existing OrderValidation instance
+     * @param other The existing instance to copy.
+     */
+    private Builder(de.trion.microservices.avro.OrderValidation other) {
+      super(SCHEMA$);
+      if (isValidValue(fields()[0], other.orderId)) {
+        this.orderId = data().deepCopy(fields()[0].schema(), other.orderId);
+        fieldSetFlags()[0] = true;
+      }
+      if (isValidValue(fields()[1], other.checkType)) {
+        this.checkType = data().deepCopy(fields()[1].schema(), other.checkType);
+        fieldSetFlags()[1] = true;
+      }
+      if (isValidValue(fields()[2], other.validationResult)) {
+        this.validationResult = data().deepCopy(fields()[2].schema(), other.validationResult);
+        fieldSetFlags()[2] = true;
+      }
+      if (isValidValue(fields()[3], other.messages)) {
+        this.messages = data().deepCopy(fields()[3].schema(), other.messages);
+        fieldSetFlags()[3] = true;
+      }
+    }
+
+    /**
+      * Gets the value of the 'orderId' field.
+      * @return The value.
+      */
+    public java.lang.CharSequence getOrderId() {
+      return orderId;
+    }
+
+
+    /**
+      * Sets the value of the 'orderId' field.
+      * @param value The value of 'orderId'.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.OrderValidation.Builder setOrderId(java.lang.CharSequence value) {
+      validate(fields()[0], value);
+      this.orderId = value;
+      fieldSetFlags()[0] = 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()[0];
+    }
+
+
+    /**
+      * Clears the value of the 'orderId' field.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.OrderValidation.Builder clearOrderId() {
+      orderId = null;
+      fieldSetFlags()[0] = false;
+      return this;
+    }
+
+    /**
+      * Gets the value of the 'checkType' field.
+      * @return The value.
+      */
+    public de.trion.microservices.avro.OrderValidationType getCheckType() {
+      return checkType;
+    }
+
+
+    /**
+      * Sets the value of the 'checkType' field.
+      * @param value The value of 'checkType'.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.OrderValidation.Builder setCheckType(de.trion.microservices.avro.OrderValidationType value) {
+      validate(fields()[1], value);
+      this.checkType = value;
+      fieldSetFlags()[1] = true;
+      return this;
+    }
+
+    /**
+      * Checks whether the 'checkType' field has been set.
+      * @return True if the 'checkType' field has been set, false otherwise.
+      */
+    public boolean hasCheckType() {
+      return fieldSetFlags()[1];
+    }
+
+
+    /**
+      * Clears the value of the 'checkType' field.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.OrderValidation.Builder clearCheckType() {
+      checkType = null;
+      fieldSetFlags()[1] = false;
+      return this;
+    }
+
+    /**
+      * Gets the value of the 'validationResult' field.
+      * @return The value.
+      */
+    public de.trion.microservices.avro.OrderValidationResult getValidationResult() {
+      return validationResult;
+    }
+
+
+    /**
+      * Sets the value of the 'validationResult' field.
+      * @param value The value of 'validationResult'.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.OrderValidation.Builder setValidationResult(de.trion.microservices.avro.OrderValidationResult value) {
+      validate(fields()[2], value);
+      this.validationResult = value;
+      fieldSetFlags()[2] = true;
+      return this;
+    }
+
+    /**
+      * Checks whether the 'validationResult' field has been set.
+      * @return True if the 'validationResult' field has been set, false otherwise.
+      */
+    public boolean hasValidationResult() {
+      return fieldSetFlags()[2];
+    }
+
+
+    /**
+      * Clears the value of the 'validationResult' field.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.OrderValidation.Builder clearValidationResult() {
+      validationResult = null;
+      fieldSetFlags()[2] = false;
+      return this;
+    }
+
+    /**
+      * Gets the value of the 'messages' field.
+      * @return The value.
+      */
+    public java.util.List<java.lang.CharSequence> getMessages() {
+      return messages;
+    }
+
+
+    /**
+      * Sets the value of the 'messages' field.
+      * @param value The value of 'messages'.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.OrderValidation.Builder setMessages(java.util.List<java.lang.CharSequence> value) {
+      validate(fields()[3], value);
+      this.messages = value;
+      fieldSetFlags()[3] = true;
+      return this;
+    }
+
+    /**
+      * Checks whether the 'messages' field has been set.
+      * @return True if the 'messages' field has been set, false otherwise.
+      */
+    public boolean hasMessages() {
+      return fieldSetFlags()[3];
+    }
+
+
+    /**
+      * Clears the value of the 'messages' field.
+      * @return This builder.
+      */
+    public de.trion.microservices.avro.OrderValidation.Builder clearMessages() {
+      messages = null;
+      fieldSetFlags()[3] = false;
+      return this;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public OrderValidation build() {
+      try {
+        OrderValidation record = new OrderValidation();
+        record.orderId = fieldSetFlags()[0] ? this.orderId : (java.lang.CharSequence) defaultValue(fields()[0]);
+        record.checkType = fieldSetFlags()[1] ? this.checkType : (de.trion.microservices.avro.OrderValidationType) defaultValue(fields()[1]);
+        record.validationResult = fieldSetFlags()[2] ? this.validationResult : (de.trion.microservices.avro.OrderValidationResult) defaultValue(fields()[2]);
+        record.messages = fieldSetFlags()[3] ? this.messages : (java.util.List<java.lang.CharSequence>) defaultValue(fields()[3]);
+        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<OrderValidation>
+    WRITER$ = (org.apache.avro.io.DatumWriter<OrderValidation>)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<OrderValidation>
+    READER$ = (org.apache.avro.io.DatumReader<OrderValidation>)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.orderId);
+
+    out.writeEnum(this.checkType.ordinal());
+
+    out.writeEnum(this.validationResult.ordinal());
+
+    long size0 = this.messages.size();
+    out.writeArrayStart();
+    out.setItemCount(size0);
+    long actualSize0 = 0;
+    for (java.lang.CharSequence e0: this.messages) {
+      actualSize0++;
+      out.startItem();
+      out.writeString(e0);
+    }
+    out.writeArrayEnd();
+    if (actualSize0 != size0)
+      throw new java.util.ConcurrentModificationException("Array-size written was " + size0 + ", but element count was " + actualSize0 + ".");
+
+  }
+
+  @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.orderId = in.readString(this.orderId instanceof Utf8 ? (Utf8)this.orderId : null);
+
+      this.checkType = de.trion.microservices.avro.OrderValidationType.values()[in.readEnum()];
+
+      this.validationResult = de.trion.microservices.avro.OrderValidationResult.values()[in.readEnum()];
+
+      long size0 = in.readArrayStart();
+      java.util.List<java.lang.CharSequence> a0 = this.messages;
+      if (a0 == null) {
+        a0 = new SpecificData.Array<java.lang.CharSequence>((int)size0, SCHEMA$.getField("messages").schema());
+        this.messages = a0;
+      } else a0.clear();
+      SpecificData.Array<java.lang.CharSequence> ga0 = (a0 instanceof SpecificData.Array ? (SpecificData.Array<java.lang.CharSequence>)a0 : null);
+      for ( ; 0 < size0; size0 = in.arrayNext()) {
+        for ( ; size0 != 0; size0--) {
+          java.lang.CharSequence e0 = (ga0 != null ? ga0.peek() : null);
+          e0 = in.readString(e0 instanceof Utf8 ? (Utf8)e0 : null);
+          a0.add(e0);
+        }
+      }
+
+    } else {
+      for (int i = 0; i < 4; i++) {
+        switch (fieldOrder[i].pos()) {
+        case 0:
+          this.orderId = in.readString(this.orderId instanceof Utf8 ? (Utf8)this.orderId : null);
+          break;
+
+        case 1:
+          this.checkType = de.trion.microservices.avro.OrderValidationType.values()[in.readEnum()];
+          break;
+
+        case 2:
+          this.validationResult = de.trion.microservices.avro.OrderValidationResult.values()[in.readEnum()];
+          break;
+
+        case 3:
+          long size0 = in.readArrayStart();
+          java.util.List<java.lang.CharSequence> a0 = this.messages;
+          if (a0 == null) {
+            a0 = new SpecificData.Array<java.lang.CharSequence>((int)size0, SCHEMA$.getField("messages").schema());
+            this.messages = a0;
+          } else a0.clear();
+          SpecificData.Array<java.lang.CharSequence> ga0 = (a0 instanceof SpecificData.Array ? (SpecificData.Array<java.lang.CharSequence>)a0 : null);
+          for ( ; 0 < size0; size0 = in.arrayNext()) {
+            for ( ; size0 != 0; size0--) {
+              java.lang.CharSequence e0 = (ga0 != null ? ga0.peek() : null);
+              e0 = in.readString(e0 instanceof Utf8 ? (Utf8)e0 : null);
+              a0.add(e0);
+            }
+          }
+          break;
+
+        default:
+          throw new java.io.IOException("Corrupt ResolvingDecoder.");
+        }
+      }
+    }
+  }
+}
+
+
+
+
+
+
+
+
+
+