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

Energistics.Datatypes.Version Maven / Gradle / Ivy

The newest version!
/**
 * Autogenerated by Avro
 *
 * DO NOT EDIT DIRECTLY
 */
package Energistics.Datatypes;

import org.apache.avro.message.BinaryMessageDecoder;
import org.apache.avro.message.BinaryMessageEncoder;
import org.apache.avro.message.SchemaStore;
import org.apache.avro.specific.SpecificData;

@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class Version extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
    private static final long serialVersionUID = 4802784677425695374L;
    public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"Version\",\"namespace\":\"Energistics.Datatypes\",\"fields\":[{\"name\":\"major\",\"type\":\"int\"},{\"name\":\"minor\",\"type\":\"int\"},{\"name\":\"revision\",\"type\":\"int\"},{\"name\":\"patch\",\"type\":\"int\"}],\"fullName\":\"Energistics.Datatypes.Version\",\"depends\":[]}");

    public static org.apache.avro.Schema getClassSchema() {
        return SCHEMA$;
    }

    private static SpecificData MODEL$ = new SpecificData();

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

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

    /**
     * Return the BinaryMessageDecoder instance 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
     */
    public static BinaryMessageDecoder createDecoder(SchemaStore resolver) {
        return new BinaryMessageDecoder(MODEL$, SCHEMA$, resolver);
    }

    /**
     * Serializes this Version to a ByteBuffer.
     */
    public java.nio.ByteBuffer toByteBuffer() throws java.io.IOException {
        return ENCODER.encode(this);
    }

    /**
     * Deserializes a Version from a ByteBuffer.
     */
    public static Version fromByteBuffer(
            java.nio.ByteBuffer b) throws java.io.IOException {
        return DECODER.decode(b);
    }

    private int major;
    private int minor;
    private int revision;
    private int patch;

    /**
     * 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 Version() {
    }

    /**
     * All-args constructor.
     *
     * @param major    The new value for major
     * @param minor    The new value for minor
     * @param revision The new value for revision
     * @param patch    The new value for patch
     */
    public Version(java.lang.Integer major, java.lang.Integer minor, java.lang.Integer revision, java.lang.Integer patch) {
        this.major = major;
        this.minor = minor;
        this.revision = revision;
        this.patch = patch;
    }

    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 major;
            case 1:
                return minor;
            case 2:
                return revision;
            case 3:
                return patch;
            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:
                major = (java.lang.Integer) value$;
                break;
            case 1:
                minor = (java.lang.Integer) value$;
                break;
            case 2:
                revision = (java.lang.Integer) value$;
                break;
            case 3:
                patch = (java.lang.Integer) value$;
                break;
            default:
                throw new org.apache.avro.AvroRuntimeException("Bad index");
        }
    }

    /**
     * Gets the value of the 'major' field.
     *
     * @return The value of the 'major' field.
     */
    public java.lang.Integer getMajor() {
        return major;
    }

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

    /**
     * Gets the value of the 'minor' field.
     *
     * @return The value of the 'minor' field.
     */
    public java.lang.Integer getMinor() {
        return minor;
    }

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

    /**
     * Gets the value of the 'revision' field.
     *
     * @return The value of the 'revision' field.
     */
    public java.lang.Integer getRevision() {
        return revision;
    }

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

    /**
     * Gets the value of the 'patch' field.
     *
     * @return The value of the 'patch' field.
     */
    public java.lang.Integer getPatch() {
        return patch;
    }

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

    /**
     * Creates a new Version RecordBuilder.
     *
     * @return A new Version RecordBuilder
     */
    public static Energistics.Datatypes.Version.Builder newBuilder() {
        return new Energistics.Datatypes.Version.Builder();
    }

    /**
     * Creates a new Version RecordBuilder by copying an existing Builder.
     *
     * @param other The existing builder to copy.
     * @return A new Version RecordBuilder
     */
    public static Energistics.Datatypes.Version.Builder newBuilder(Energistics.Datatypes.Version.Builder other) {
        return new Energistics.Datatypes.Version.Builder(other);
    }

    /**
     * Creates a new Version RecordBuilder by copying an existing Version instance.
     *
     * @param other The existing instance to copy.
     * @return A new Version RecordBuilder
     */
    public static Energistics.Datatypes.Version.Builder newBuilder(Energistics.Datatypes.Version other) {
        return new Energistics.Datatypes.Version.Builder(other);
    }

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

        private int major;
        private int minor;
        private int revision;
        private int patch;

        /** 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(Energistics.Datatypes.Version.Builder other) {
            super(other);
            if (isValidValue(fields()[0], other.major)) {
                this.major = data().deepCopy(fields()[0].schema(), other.major);
                fieldSetFlags()[0] = true;
            }
            if (isValidValue(fields()[1], other.minor)) {
                this.minor = data().deepCopy(fields()[1].schema(), other.minor);
                fieldSetFlags()[1] = true;
            }
            if (isValidValue(fields()[2], other.revision)) {
                this.revision = data().deepCopy(fields()[2].schema(), other.revision);
                fieldSetFlags()[2] = true;
            }
            if (isValidValue(fields()[3], other.patch)) {
                this.patch = data().deepCopy(fields()[3].schema(), other.patch);
                fieldSetFlags()[3] = true;
            }
        }

        /**
         * Creates a Builder by copying an existing Version instance
         *
         * @param other The existing instance to copy.
         */
        private Builder(Energistics.Datatypes.Version other) {
            super(SCHEMA$);
            if (isValidValue(fields()[0], other.major)) {
                this.major = data().deepCopy(fields()[0].schema(), other.major);
                fieldSetFlags()[0] = true;
            }
            if (isValidValue(fields()[1], other.minor)) {
                this.minor = data().deepCopy(fields()[1].schema(), other.minor);
                fieldSetFlags()[1] = true;
            }
            if (isValidValue(fields()[2], other.revision)) {
                this.revision = data().deepCopy(fields()[2].schema(), other.revision);
                fieldSetFlags()[2] = true;
            }
            if (isValidValue(fields()[3], other.patch)) {
                this.patch = data().deepCopy(fields()[3].schema(), other.patch);
                fieldSetFlags()[3] = true;
            }
        }

        /**
         * Gets the value of the 'major' field.
         *
         * @return The value.
         */
        public java.lang.Integer getMajor() {
            return major;
        }

        /**
         * Sets the value of the 'major' field.
         *
         * @param value The value of 'major'.
         * @return This builder.
         */
        public Energistics.Datatypes.Version.Builder setMajor(int value) {
            validate(fields()[0], value);
            this.major = value;
            fieldSetFlags()[0] = true;
            return this;
        }

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


        /**
         * Clears the value of the 'major' field.
         *
         * @return This builder.
         */
        public Energistics.Datatypes.Version.Builder clearMajor() {
            fieldSetFlags()[0] = false;
            return this;
        }

        /**
         * Gets the value of the 'minor' field.
         *
         * @return The value.
         */
        public java.lang.Integer getMinor() {
            return minor;
        }

        /**
         * Sets the value of the 'minor' field.
         *
         * @param value The value of 'minor'.
         * @return This builder.
         */
        public Energistics.Datatypes.Version.Builder setMinor(int value) {
            validate(fields()[1], value);
            this.minor = value;
            fieldSetFlags()[1] = true;
            return this;
        }

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


        /**
         * Clears the value of the 'minor' field.
         *
         * @return This builder.
         */
        public Energistics.Datatypes.Version.Builder clearMinor() {
            fieldSetFlags()[1] = false;
            return this;
        }

        /**
         * Gets the value of the 'revision' field.
         *
         * @return The value.
         */
        public java.lang.Integer getRevision() {
            return revision;
        }

        /**
         * Sets the value of the 'revision' field.
         *
         * @param value The value of 'revision'.
         * @return This builder.
         */
        public Energistics.Datatypes.Version.Builder setRevision(int value) {
            validate(fields()[2], value);
            this.revision = value;
            fieldSetFlags()[2] = true;
            return this;
        }

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


        /**
         * Clears the value of the 'revision' field.
         *
         * @return This builder.
         */
        public Energistics.Datatypes.Version.Builder clearRevision() {
            fieldSetFlags()[2] = false;
            return this;
        }

        /**
         * Gets the value of the 'patch' field.
         *
         * @return The value.
         */
        public java.lang.Integer getPatch() {
            return patch;
        }

        /**
         * Sets the value of the 'patch' field.
         *
         * @param value The value of 'patch'.
         * @return This builder.
         */
        public Energistics.Datatypes.Version.Builder setPatch(int value) {
            validate(fields()[3], value);
            this.patch = value;
            fieldSetFlags()[3] = true;
            return this;
        }

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


        /**
         * Clears the value of the 'patch' field.
         *
         * @return This builder.
         */
        public Energistics.Datatypes.Version.Builder clearPatch() {
            fieldSetFlags()[3] = false;
            return this;
        }

        @Override
        @SuppressWarnings("unchecked")
        public Version build() {
            try {
                Version record = new Version();
                record.major = fieldSetFlags()[0] ? this.major : (java.lang.Integer) defaultValue(fields()[0]);
                record.minor = fieldSetFlags()[1] ? this.minor : (java.lang.Integer) defaultValue(fields()[1]);
                record.revision = fieldSetFlags()[2] ? this.revision : (java.lang.Integer) defaultValue(fields()[2]);
                record.patch = fieldSetFlags()[3] ? this.patch : (java.lang.Integer) defaultValue(fields()[3]);
                return record;
            } 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));
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy