All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.networknt.scheduler.TaskDefinition Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Avro
 *
 * DO NOT EDIT DIRECTLY
 */
package com.networknt.scheduler;

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 TaskDefinition extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  private static final long serialVersionUID = 410678981943919853L;


  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"TaskDefinition\",\"namespace\":\"com.networknt.scheduler\",\"fields\":[{\"name\":\"host\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"name\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"action\",\"type\":{\"type\":\"enum\",\"name\":\"DefinitionAction\",\"symbols\":[\"INSERT\",\"UPDATE\",\"DELETE\"]}},{\"name\":\"frequency\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"TaskFrequency\",\"fields\":[{\"name\":\"timeUnit\",\"type\":{\"type\":\"enum\",\"name\":\"TimeUnit\",\"symbols\":[\"MILLISECONDS\",\"SECONDS\",\"MINUTES\",\"HOURS\",\"DAYS\"]}},{\"name\":\"time\",\"type\":\"int\"}]}],\"default\":null},{\"name\":\"topic\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"start\",\"type\":\"long\"},{\"name\":\"data\",\"type\":[\"null\",{\"type\":\"map\",\"values\":{\"type\":\"string\",\"avro.java.string\":\"String\"},\"avro.java.string\":\"String\"}],\"default\":null}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }

  private static final SpecificData MODEL$ = new SpecificData();

  private static final BinaryMessageEncoder ENCODER =
      new BinaryMessageEncoder<>(MODEL$, SCHEMA$);

  private static final BinaryMessageDecoder DECODER =
      new BinaryMessageDecoder<>(MODEL$, SCHEMA$);

  /**
   * Return the BinaryMessageEncoder instance used by this class.
   * @return the message encoder used by this class
   */
  public static BinaryMessageEncoder getEncoder() {
    return ENCODER;
  }

  /**
   * Return the BinaryMessageDecoder instance used by this class.
   * @return the message decoder used by this class
   */
  public static BinaryMessageDecoder 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 createDecoder(SchemaStore resolver) {
    return new BinaryMessageDecoder<>(MODEL$, SCHEMA$, resolver);
  }

  /**
   * Serializes this TaskDefinition 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 TaskDefinition from a ByteBuffer.
   * @param b a byte buffer holding serialized data for an instance of this class
   * @return a TaskDefinition 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 TaskDefinition fromByteBuffer(
      java.nio.ByteBuffer b) throws java.io.IOException {
    return DECODER.decode(b);
  }

  private java.lang.String host;
  private java.lang.String name;
  private com.networknt.scheduler.DefinitionAction action;
  private com.networknt.scheduler.TaskFrequency frequency;
  private java.lang.String topic;
  private long start;
  private java.util.Map data;

  /**
   * Default constructor.  Note that this does not initialize fields
   * to their default values from the schema.  If that is desired then
   * one should use newBuilder().
   */
  public TaskDefinition() {}

  /**
   * All-args constructor.
   * @param host The new value for host
   * @param name The new value for name
   * @param action The new value for action
   * @param frequency The new value for frequency
   * @param topic The new value for topic
   * @param start The new value for start
   * @param data The new value for data
   */
  public TaskDefinition(java.lang.String host, java.lang.String name, com.networknt.scheduler.DefinitionAction action, com.networknt.scheduler.TaskFrequency frequency, java.lang.String topic, java.lang.Long start, java.util.Map data) {
    this.host = host;
    this.name = name;
    this.action = action;
    this.frequency = frequency;
    this.topic = topic;
    this.start = start;
    this.data = data;
  }

  @Override
  public org.apache.avro.specific.SpecificData getSpecificData() { return MODEL$; }

  @Override
  public org.apache.avro.Schema getSchema() { return SCHEMA$; }

  // Used by DatumWriter.  Applications should not call.
  @Override
  public java.lang.Object get(int field$) {
    switch (field$) {
    case 0: return host;
    case 1: return name;
    case 2: return action;
    case 3: return frequency;
    case 4: return topic;
    case 5: return start;
    case 6: return data;
    default: throw new IndexOutOfBoundsException("Invalid index: " + field$);
    }
  }

  // Used by DatumReader.  Applications should not call.
  @Override
  @SuppressWarnings(value="unchecked")
  public void put(int field$, java.lang.Object value$) {
    switch (field$) {
    case 0: host = value$ != null ? value$.toString() : null; break;
    case 1: name = value$ != null ? value$.toString() : null; break;
    case 2: action = (com.networknt.scheduler.DefinitionAction)value$; break;
    case 3: frequency = (com.networknt.scheduler.TaskFrequency)value$; break;
    case 4: topic = value$ != null ? value$.toString() : null; break;
    case 5: start = (java.lang.Long)value$; break;
    case 6: data = (java.util.Map)value$; break;
    default: throw new IndexOutOfBoundsException("Invalid index: " + field$);
    }
  }

  /**
   * Gets the value of the 'host' field.
   * @return The value of the 'host' field.
   */
  public java.lang.String getHost() {
    return host;
  }


  /**
   * Sets the value of the 'host' field.
   * @param value the value to set.
   */
  public void setHost(java.lang.String value) {
    this.host = value;
  }

  /**
   * Gets the value of the 'name' field.
   * @return The value of the 'name' field.
   */
  public java.lang.String getName() {
    return name;
  }


  /**
   * Sets the value of the 'name' field.
   * @param value the value to set.
   */
  public void setName(java.lang.String value) {
    this.name = value;
  }

  /**
   * Gets the value of the 'action' field.
   * @return The value of the 'action' field.
   */
  public com.networknt.scheduler.DefinitionAction getAction() {
    return action;
  }


  /**
   * Sets the value of the 'action' field.
   * @param value the value to set.
   */
  public void setAction(com.networknt.scheduler.DefinitionAction value) {
    this.action = value;
  }

  /**
   * Gets the value of the 'frequency' field.
   * @return The value of the 'frequency' field.
   */
  public com.networknt.scheduler.TaskFrequency getFrequency() {
    return frequency;
  }


  /**
   * Sets the value of the 'frequency' field.
   * @param value the value to set.
   */
  public void setFrequency(com.networknt.scheduler.TaskFrequency value) {
    this.frequency = value;
  }

  /**
   * Gets the value of the 'topic' field.
   * @return The value of the 'topic' field.
   */
  public java.lang.String getTopic() {
    return topic;
  }


  /**
   * Sets the value of the 'topic' field.
   * @param value the value to set.
   */
  public void setTopic(java.lang.String value) {
    this.topic = value;
  }

  /**
   * Gets the value of the 'start' field.
   * @return The value of the 'start' field.
   */
  public long getStart() {
    return start;
  }


  /**
   * Sets the value of the 'start' field.
   * @param value the value to set.
   */
  public void setStart(long value) {
    this.start = value;
  }

  /**
   * Gets the value of the 'data' field.
   * @return The value of the 'data' field.
   */
  public java.util.Map getData() {
    return data;
  }


  /**
   * Sets the value of the 'data' field.
   * @param value the value to set.
   */
  public void setData(java.util.Map value) {
    this.data = value;
  }

  /**
   * Creates a new TaskDefinition RecordBuilder.
   * @return A new TaskDefinition RecordBuilder
   */
  public static com.networknt.scheduler.TaskDefinition.Builder newBuilder() {
    return new com.networknt.scheduler.TaskDefinition.Builder();
  }

  /**
   * Creates a new TaskDefinition RecordBuilder by copying an existing Builder.
   * @param other The existing builder to copy.
   * @return A new TaskDefinition RecordBuilder
   */
  public static com.networknt.scheduler.TaskDefinition.Builder newBuilder(com.networknt.scheduler.TaskDefinition.Builder other) {
    if (other == null) {
      return new com.networknt.scheduler.TaskDefinition.Builder();
    } else {
      return new com.networknt.scheduler.TaskDefinition.Builder(other);
    }
  }

  /**
   * Creates a new TaskDefinition RecordBuilder by copying an existing TaskDefinition instance.
   * @param other The existing instance to copy.
   * @return A new TaskDefinition RecordBuilder
   */
  public static com.networknt.scheduler.TaskDefinition.Builder newBuilder(com.networknt.scheduler.TaskDefinition other) {
    if (other == null) {
      return new com.networknt.scheduler.TaskDefinition.Builder();
    } else {
      return new com.networknt.scheduler.TaskDefinition.Builder(other);
    }
  }

  /**
   * RecordBuilder for TaskDefinition instances.
   */
  @org.apache.avro.specific.AvroGenerated
  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase
    implements org.apache.avro.data.RecordBuilder {

    private java.lang.String host;
    private java.lang.String name;
    private com.networknt.scheduler.DefinitionAction action;
    private com.networknt.scheduler.TaskFrequency frequency;
    private com.networknt.scheduler.TaskFrequency.Builder frequencyBuilder;
    private java.lang.String topic;
    private long start;
    private java.util.Map data;

    /** Creates a new Builder */
    private Builder() {
      super(SCHEMA$, MODEL$);
    }

    /**
     * Creates a Builder by copying an existing Builder.
     * @param other The existing Builder to copy.
     */
    private Builder(com.networknt.scheduler.TaskDefinition.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.host)) {
        this.host = data().deepCopy(fields()[0].schema(), other.host);
        fieldSetFlags()[0] = other.fieldSetFlags()[0];
      }
      if (isValidValue(fields()[1], other.name)) {
        this.name = data().deepCopy(fields()[1].schema(), other.name);
        fieldSetFlags()[1] = other.fieldSetFlags()[1];
      }
      if (isValidValue(fields()[2], other.action)) {
        this.action = data().deepCopy(fields()[2].schema(), other.action);
        fieldSetFlags()[2] = other.fieldSetFlags()[2];
      }
      if (isValidValue(fields()[3], other.frequency)) {
        this.frequency = data().deepCopy(fields()[3].schema(), other.frequency);
        fieldSetFlags()[3] = other.fieldSetFlags()[3];
      }
      if (other.hasFrequencyBuilder()) {
        this.frequencyBuilder = com.networknt.scheduler.TaskFrequency.newBuilder(other.getFrequencyBuilder());
      }
      if (isValidValue(fields()[4], other.topic)) {
        this.topic = data().deepCopy(fields()[4].schema(), other.topic);
        fieldSetFlags()[4] = other.fieldSetFlags()[4];
      }
      if (isValidValue(fields()[5], other.start)) {
        this.start = data().deepCopy(fields()[5].schema(), other.start);
        fieldSetFlags()[5] = other.fieldSetFlags()[5];
      }
      if (isValidValue(fields()[6], other.data)) {
        this.data = data().deepCopy(fields()[6].schema(), other.data);
        fieldSetFlags()[6] = other.fieldSetFlags()[6];
      }
    }

    /**
     * Creates a Builder by copying an existing TaskDefinition instance
     * @param other The existing instance to copy.
     */
    private Builder(com.networknt.scheduler.TaskDefinition other) {
      super(SCHEMA$, MODEL$);
      if (isValidValue(fields()[0], other.host)) {
        this.host = data().deepCopy(fields()[0].schema(), other.host);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.name)) {
        this.name = data().deepCopy(fields()[1].schema(), other.name);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.action)) {
        this.action = data().deepCopy(fields()[2].schema(), other.action);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.frequency)) {
        this.frequency = data().deepCopy(fields()[3].schema(), other.frequency);
        fieldSetFlags()[3] = true;
      }
      this.frequencyBuilder = null;
      if (isValidValue(fields()[4], other.topic)) {
        this.topic = data().deepCopy(fields()[4].schema(), other.topic);
        fieldSetFlags()[4] = true;
      }
      if (isValidValue(fields()[5], other.start)) {
        this.start = data().deepCopy(fields()[5].schema(), other.start);
        fieldSetFlags()[5] = true;
      }
      if (isValidValue(fields()[6], other.data)) {
        this.data = data().deepCopy(fields()[6].schema(), other.data);
        fieldSetFlags()[6] = true;
      }
    }

    /**
      * Gets the value of the 'host' field.
      * @return The value.
      */
    public java.lang.String getHost() {
      return host;
    }


    /**
      * Sets the value of the 'host' field.
      * @param value The value of 'host'.
      * @return This builder.
      */
    public com.networknt.scheduler.TaskDefinition.Builder setHost(java.lang.String value) {
      validate(fields()[0], value);
      this.host = value;
      fieldSetFlags()[0] = true;
      return this;
    }

    /**
      * Checks whether the 'host' field has been set.
      * @return True if the 'host' field has been set, false otherwise.
      */
    public boolean hasHost() {
      return fieldSetFlags()[0];
    }


    /**
      * Clears the value of the 'host' field.
      * @return This builder.
      */
    public com.networknt.scheduler.TaskDefinition.Builder clearHost() {
      host = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /**
      * Gets the value of the 'name' field.
      * @return The value.
      */
    public java.lang.String getName() {
      return name;
    }


    /**
      * Sets the value of the 'name' field.
      * @param value The value of 'name'.
      * @return This builder.
      */
    public com.networknt.scheduler.TaskDefinition.Builder setName(java.lang.String value) {
      validate(fields()[1], value);
      this.name = value;
      fieldSetFlags()[1] = true;
      return this;
    }

    /**
      * Checks whether the 'name' field has been set.
      * @return True if the 'name' field has been set, false otherwise.
      */
    public boolean hasName() {
      return fieldSetFlags()[1];
    }


    /**
      * Clears the value of the 'name' field.
      * @return This builder.
      */
    public com.networknt.scheduler.TaskDefinition.Builder clearName() {
      name = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /**
      * Gets the value of the 'action' field.
      * @return The value.
      */
    public com.networknt.scheduler.DefinitionAction getAction() {
      return action;
    }


    /**
      * Sets the value of the 'action' field.
      * @param value The value of 'action'.
      * @return This builder.
      */
    public com.networknt.scheduler.TaskDefinition.Builder setAction(com.networknt.scheduler.DefinitionAction value) {
      validate(fields()[2], value);
      this.action = value;
      fieldSetFlags()[2] = true;
      return this;
    }

    /**
      * Checks whether the 'action' field has been set.
      * @return True if the 'action' field has been set, false otherwise.
      */
    public boolean hasAction() {
      return fieldSetFlags()[2];
    }


    /**
      * Clears the value of the 'action' field.
      * @return This builder.
      */
    public com.networknt.scheduler.TaskDefinition.Builder clearAction() {
      action = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    /**
      * Gets the value of the 'frequency' field.
      * @return The value.
      */
    public com.networknt.scheduler.TaskFrequency getFrequency() {
      return frequency;
    }


    /**
      * Sets the value of the 'frequency' field.
      * @param value The value of 'frequency'.
      * @return This builder.
      */
    public com.networknt.scheduler.TaskDefinition.Builder setFrequency(com.networknt.scheduler.TaskFrequency value) {
      validate(fields()[3], value);
      this.frequencyBuilder = null;
      this.frequency = value;
      fieldSetFlags()[3] = true;
      return this;
    }

    /**
      * Checks whether the 'frequency' field has been set.
      * @return True if the 'frequency' field has been set, false otherwise.
      */
    public boolean hasFrequency() {
      return fieldSetFlags()[3];
    }

    /**
     * Gets the Builder instance for the 'frequency' field and creates one if it doesn't exist yet.
     * @return This builder.
     */
    public com.networknt.scheduler.TaskFrequency.Builder getFrequencyBuilder() {
      if (frequencyBuilder == null) {
        if (hasFrequency()) {
          setFrequencyBuilder(com.networknt.scheduler.TaskFrequency.newBuilder(frequency));
        } else {
          setFrequencyBuilder(com.networknt.scheduler.TaskFrequency.newBuilder());
        }
      }
      return frequencyBuilder;
    }

    /**
     * Sets the Builder instance for the 'frequency' field
     * @param value The builder instance that must be set.
     * @return This builder.
     */

    public com.networknt.scheduler.TaskDefinition.Builder setFrequencyBuilder(com.networknt.scheduler.TaskFrequency.Builder value) {
      clearFrequency();
      frequencyBuilder = value;
      return this;
    }

    /**
     * Checks whether the 'frequency' field has an active Builder instance
     * @return True if the 'frequency' field has an active Builder instance
     */
    public boolean hasFrequencyBuilder() {
      return frequencyBuilder != null;
    }

    /**
      * Clears the value of the 'frequency' field.
      * @return This builder.
      */
    public com.networknt.scheduler.TaskDefinition.Builder clearFrequency() {
      frequency = null;
      frequencyBuilder = null;
      fieldSetFlags()[3] = false;
      return this;
    }

    /**
      * Gets the value of the 'topic' field.
      * @return The value.
      */
    public java.lang.String getTopic() {
      return topic;
    }


    /**
      * Sets the value of the 'topic' field.
      * @param value The value of 'topic'.
      * @return This builder.
      */
    public com.networknt.scheduler.TaskDefinition.Builder setTopic(java.lang.String value) {
      validate(fields()[4], value);
      this.topic = value;
      fieldSetFlags()[4] = true;
      return this;
    }

    /**
      * Checks whether the 'topic' field has been set.
      * @return True if the 'topic' field has been set, false otherwise.
      */
    public boolean hasTopic() {
      return fieldSetFlags()[4];
    }


    /**
      * Clears the value of the 'topic' field.
      * @return This builder.
      */
    public com.networknt.scheduler.TaskDefinition.Builder clearTopic() {
      topic = null;
      fieldSetFlags()[4] = false;
      return this;
    }

    /**
      * Gets the value of the 'start' field.
      * @return The value.
      */
    public long getStart() {
      return start;
    }


    /**
      * Sets the value of the 'start' field.
      * @param value The value of 'start'.
      * @return This builder.
      */
    public com.networknt.scheduler.TaskDefinition.Builder setStart(long value) {
      validate(fields()[5], value);
      this.start = value;
      fieldSetFlags()[5] = true;
      return this;
    }

    /**
      * Checks whether the 'start' field has been set.
      * @return True if the 'start' field has been set, false otherwise.
      */
    public boolean hasStart() {
      return fieldSetFlags()[5];
    }


    /**
      * Clears the value of the 'start' field.
      * @return This builder.
      */
    public com.networknt.scheduler.TaskDefinition.Builder clearStart() {
      fieldSetFlags()[5] = false;
      return this;
    }

    /**
      * Gets the value of the 'data' field.
      * @return The value.
      */
    public java.util.Map getData() {
      return data;
    }


    /**
      * Sets the value of the 'data' field.
      * @param value The value of 'data'.
      * @return This builder.
      */
    public com.networknt.scheduler.TaskDefinition.Builder setData(java.util.Map value) {
      validate(fields()[6], value);
      this.data = value;
      fieldSetFlags()[6] = true;
      return this;
    }

    /**
      * Checks whether the 'data' field has been set.
      * @return True if the 'data' field has been set, false otherwise.
      */
    public boolean hasData() {
      return fieldSetFlags()[6];
    }


    /**
      * Clears the value of the 'data' field.
      * @return This builder.
      */
    public com.networknt.scheduler.TaskDefinition.Builder clearData() {
      data = null;
      fieldSetFlags()[6] = false;
      return this;
    }

    @Override
    @SuppressWarnings("unchecked")
    public TaskDefinition build() {
      try {
        TaskDefinition record = new TaskDefinition();
        record.host = fieldSetFlags()[0] ? this.host : (java.lang.String) defaultValue(fields()[0]);
        record.name = fieldSetFlags()[1] ? this.name : (java.lang.String) defaultValue(fields()[1]);
        record.action = fieldSetFlags()[2] ? this.action : (com.networknt.scheduler.DefinitionAction) defaultValue(fields()[2]);
        if (frequencyBuilder != null) {
          try {
            record.frequency = this.frequencyBuilder.build();
          } catch (org.apache.avro.AvroMissingFieldException e) {
            e.addParentField(record.getSchema().getField("frequency"));
            throw e;
          }
        } else {
          record.frequency = fieldSetFlags()[3] ? this.frequency : (com.networknt.scheduler.TaskFrequency) defaultValue(fields()[3]);
        }
        record.topic = fieldSetFlags()[4] ? this.topic : (java.lang.String) defaultValue(fields()[4]);
        record.start = fieldSetFlags()[5] ? this.start : (java.lang.Long) defaultValue(fields()[5]);
        record.data = fieldSetFlags()[6] ? this.data : (java.util.Map) defaultValue(fields()[6]);
        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
    WRITER$ = (org.apache.avro.io.DatumWriter)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
    READER$ = (org.apache.avro.io.DatumReader)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.host);

    out.writeString(this.name);

    out.writeEnum(this.action.ordinal());

    if (this.frequency == null) {
      out.writeIndex(0);
      out.writeNull();
    } else {
      out.writeIndex(1);
      this.frequency.customEncode(out);
    }

    out.writeString(this.topic);

    out.writeLong(this.start);

    if (this.data == null) {
      out.writeIndex(0);
      out.writeNull();
    } else {
      out.writeIndex(1);
      long size0 = this.data.size();
      out.writeMapStart();
      out.setItemCount(size0);
      long actualSize0 = 0;
      for (java.util.Map.Entry e0: this.data.entrySet()) {
        actualSize0++;
        out.startItem();
        out.writeString(e0.getKey());
        java.lang.String v0 = e0.getValue();
        out.writeString(v0);
      }
      out.writeMapEnd();
      if (actualSize0 != size0)
      throw new java.util.ConcurrentModificationException("Map-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.host = in.readString();

      this.name = in.readString();

      this.action = com.networknt.scheduler.DefinitionAction.values()[in.readEnum()];

      if (in.readIndex() != 1) {
        in.readNull();
        this.frequency = null;
      } else {
        if (this.frequency == null) {
          this.frequency = new com.networknt.scheduler.TaskFrequency();
        }
        this.frequency.customDecode(in);
      }

      this.topic = in.readString();

      this.start = in.readLong();

      if (in.readIndex() != 1) {
        in.readNull();
        this.data = null;
      } else {
        long size0 = in.readMapStart();
        java.util.Map m0 = this.data; // Need fresh name due to limitation of macro system
        if (m0 == null) {
          m0 = new java.util.HashMap((int)size0);
          this.data = m0;
        } else m0.clear();
        for ( ; 0 < size0; size0 = in.mapNext()) {
          for ( ; size0 != 0; size0--) {
            java.lang.String k0 = null;
            k0 = in.readString();
            java.lang.String v0 = null;
            v0 = in.readString();
            m0.put(k0, v0);
          }
        }
      }

    } else {
      for (int i = 0; i < 7; i++) {
        switch (fieldOrder[i].pos()) {
        case 0:
          this.host = in.readString();
          break;

        case 1:
          this.name = in.readString();
          break;

        case 2:
          this.action = com.networknt.scheduler.DefinitionAction.values()[in.readEnum()];
          break;

        case 3:
          if (in.readIndex() != 1) {
            in.readNull();
            this.frequency = null;
          } else {
            if (this.frequency == null) {
              this.frequency = new com.networknt.scheduler.TaskFrequency();
            }
            this.frequency.customDecode(in);
          }
          break;

        case 4:
          this.topic = in.readString();
          break;

        case 5:
          this.start = in.readLong();
          break;

        case 6:
          if (in.readIndex() != 1) {
            in.readNull();
            this.data = null;
          } else {
            long size0 = in.readMapStart();
            java.util.Map m0 = this.data; // Need fresh name due to limitation of macro system
            if (m0 == null) {
              m0 = new java.util.HashMap((int)size0);
              this.data = m0;
            } else m0.clear();
            for ( ; 0 < size0; size0 = in.mapNext()) {
              for ( ; size0 != 0; size0--) {
                java.lang.String k0 = null;
                k0 = in.readString();
                java.lang.String v0 = null;
                v0 = in.readString();
                m0.put(k0, v0);
              }
            }
          }
          break;

        default:
          throw new java.io.IOException("Corrupt ResolvingDecoder.");
        }
      }
    }
  }
}














© 2015 - 2025 Weber Informatics LLC | Privacy Policy