/**
 * Autogenerated by Avro
 *
 * DO NOT EDIT DIRECTLY
 */
package avro;

@SuppressWarnings("all")
public class FiscalRecord 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\":\"FiscalRecord\",\"namespace\":\"avro\",\"fields\":[{\"name\":\"calendarDate\",\"type\":\"string\"},{\"name\":\"fiscalWeek\",\"type\":[\"int\",\"null\"]},{\"name\":\"fiscalYear\",\"type\":[\"int\",\"null\"]}]}");
    @Deprecated
    public java.lang.CharSequence calendarDate;
    @Deprecated
    public java.lang.Integer fiscalWeek;
    @Deprecated
    public java.lang.Integer fiscalYear;

    /**
     * Default constructor.
     */
    public FiscalRecord() {
    }

    /**
     * All-args constructor.
     */
    public FiscalRecord(java.lang.CharSequence calendarDate, java.lang.Integer fiscalWeek, java.lang.Integer fiscalYear) {
        this.calendarDate = calendarDate;
        this.fiscalWeek = fiscalWeek;
        this.fiscalYear = fiscalYear;
    }

    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 calendarDate;
            case 1:
                return fiscalWeek;
            case 2:
                return fiscalYear;
            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:
                calendarDate = (java.lang.CharSequence) value$;
                break;
            case 1:
                fiscalWeek = (java.lang.Integer) value$;
                break;
            case 2:
                fiscalYear = (java.lang.Integer) value$;
                break;
            default:
                throw new org.apache.avro.AvroRuntimeException("Bad index");
        }
    }

    /**
     * Gets the value of the 'calendarDate' field.
     */
    public java.lang.CharSequence getCalendarDate() {
        return calendarDate;
    }

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

    /**
     * Gets the value of the 'fiscalWeek' field.
     */
    public java.lang.Integer getFiscalWeek() {
        return fiscalWeek;
    }

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

    /**
     * Gets the value of the 'fiscalYear' field.
     */
    public java.lang.Integer getFiscalYear() {
        return fiscalYear;
    }

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

    /**
     * Creates a new FiscalRecord RecordBuilder
     */
    public static avro.FiscalRecord.Builder newBuilder() {
        return new avro.FiscalRecord.Builder();
    }

    /**
     * Creates a new FiscalRecord RecordBuilder by copying an existing Builder
     */
    public static avro.FiscalRecord.Builder newBuilder(avro.FiscalRecord.Builder other) {
        return new avro.FiscalRecord.Builder(other);
    }

    /**
     * Creates a new FiscalRecord RecordBuilder by copying an existing FiscalRecord instance
     */
    public static avro.FiscalRecord.Builder newBuilder(avro.FiscalRecord other) {
        return new avro.FiscalRecord.Builder(other);
    }

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

        private java.lang.CharSequence calendarDate;
        private java.lang.Integer fiscalWeek;
        private java.lang.Integer fiscalYear;

        /**
         * Creates a new Builder
         */
        private Builder() {
            super(avro.FiscalRecord.SCHEMA$);
        }

        /**
         * Creates a Builder by copying an existing Builder
         */
        private Builder(avro.FiscalRecord.Builder other) {
            super(other);
        }

        /**
         * Creates a Builder by copying an existing FiscalRecord instance
         */
        private Builder(avro.FiscalRecord other) {
            super(avro.FiscalRecord.SCHEMA$);
            if (isValidValue(fields()[0], other.calendarDate)) {
                this.calendarDate = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.calendarDate);
                fieldSetFlags()[0] = true;
            }
            if (isValidValue(fields()[1], other.fiscalWeek)) {
                this.fiscalWeek = (java.lang.Integer) data().deepCopy(fields()[1].schema(), other.fiscalWeek);
                fieldSetFlags()[1] = true;
            }
            if (isValidValue(fields()[2], other.fiscalYear)) {
                this.fiscalYear = (java.lang.Integer) data().deepCopy(fields()[2].schema(), other.fiscalYear);
                fieldSetFlags()[2] = true;
            }
        }

        /**
         * Gets the value of the 'calendarDate' field
         */
        public java.lang.CharSequence getCalendarDate() {
            return calendarDate;
        }

        /**
         * Sets the value of the 'calendarDate' field
         */
        public avro.FiscalRecord.Builder setCalendarDate(java.lang.CharSequence value) {
            validate(fields()[0], value);
            this.calendarDate = value;
            fieldSetFlags()[0] = true;
            return this;
        }

        /**
         * Checks whether the 'calendarDate' field has been set
         */
        public boolean hasCalendarDate() {
            return fieldSetFlags()[0];
        }

        /**
         * Clears the value of the 'calendarDate' field
         */
        public avro.FiscalRecord.Builder clearCalendarDate() {
            calendarDate = null;
            fieldSetFlags()[0] = false;
            return this;
        }

        /**
         * Gets the value of the 'fiscalWeek' field
         */
        public java.lang.Integer getFiscalWeek() {
            return fiscalWeek;
        }

        /**
         * Sets the value of the 'fiscalWeek' field
         */
        public avro.FiscalRecord.Builder setFiscalWeek(java.lang.Integer value) {
            validate(fields()[1], value);
            this.fiscalWeek = value;
            fieldSetFlags()[1] = true;
            return this;
        }

        /**
         * Checks whether the 'fiscalWeek' field has been set
         */
        public boolean hasFiscalWeek() {
            return fieldSetFlags()[1];
        }

        /**
         * Clears the value of the 'fiscalWeek' field
         */
        public avro.FiscalRecord.Builder clearFiscalWeek() {
            fiscalWeek = null;
            fieldSetFlags()[1] = false;
            return this;
        }

        /**
         * Gets the value of the 'fiscalYear' field
         */
        public java.lang.Integer getFiscalYear() {
            return fiscalYear;
        }

        /**
         * Sets the value of the 'fiscalYear' field
         */
        public avro.FiscalRecord.Builder setFiscalYear(java.lang.Integer value) {
            validate(fields()[2], value);
            this.fiscalYear = value;
            fieldSetFlags()[2] = true;
            return this;
        }

        /**
         * Checks whether the 'fiscalYear' field has been set
         */
        public boolean hasFiscalYear() {
            return fieldSetFlags()[2];
        }

        /**
         * Clears the value of the 'fiscalYear' field
         */
        public avro.FiscalRecord.Builder clearFiscalYear() {
            fiscalYear = null;
            fieldSetFlags()[2] = false;
            return this;
        }

        @Override
        public FiscalRecord build() {
            try {
                FiscalRecord record = new FiscalRecord();
                record.calendarDate = fieldSetFlags()[0] ? this.calendarDate : (java.lang.CharSequence) defaultValue(fields()[0]);
                record.fiscalWeek = fieldSetFlags()[1] ? this.fiscalWeek : (java.lang.Integer) defaultValue(fields()[1]);
                record.fiscalYear = fieldSetFlags()[2] ? this.fiscalYear : (java.lang.Integer) defaultValue(fields()[2]);
                return record;
            } catch (Exception e) {
                throw new org.apache.avro.AvroRuntimeException(e);
            }
        }
    }
}
