ezbake.services.provenance.thrift.AgeOffRule.java Source code

Java tutorial

Introduction

Here is the source code for ezbake.services.provenance.thrift.AgeOffRule.java

Source

/*   Copyright (C) 2013-2014 Computer Sciences Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. */

/**
 * Autogenerated by Thrift Compiler (0.9.1)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package ezbake.services.provenance.thrift;

import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class AgeOffRule implements org.apache.thrift.TBase<AgeOffRule, AgeOffRule._Fields>, java.io.Serializable,
        Cloneable, Comparable<AgeOffRule> {
    private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct(
            "AgeOffRule");

    private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "name", org.apache.thrift.protocol.TType.STRING, (short) 1);
    private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "id", org.apache.thrift.protocol.TType.I64, (short) 2);
    private static final org.apache.thrift.protocol.TField RETENTION_DURATION_SECONDS_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "retentionDurationSeconds", org.apache.thrift.protocol.TType.I64, (short) 3);
    private static final org.apache.thrift.protocol.TField MAXIMUM_EXECUTION_PERIOD_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "maximumExecutionPeriod", org.apache.thrift.protocol.TType.I32, (short) 4);
    private static final org.apache.thrift.protocol.TField APPLICATION_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "application", org.apache.thrift.protocol.TType.STRING, (short) 5);
    private static final org.apache.thrift.protocol.TField USER_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "user", org.apache.thrift.protocol.TType.STRING, (short) 6);
    private static final org.apache.thrift.protocol.TField TIME_STAMP_FIELD_DESC = new org.apache.thrift.protocol.TField(
            "timeStamp", org.apache.thrift.protocol.TType.STRUCT, (short) 7);

    private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
    static {
        schemes.put(StandardScheme.class, new AgeOffRuleStandardSchemeFactory());
        schemes.put(TupleScheme.class, new AgeOffRuleTupleSchemeFactory());
    }

    public String name; // required
    public long id; // required
    public long retentionDurationSeconds; // required
    public int maximumExecutionPeriod; // required
    public String application; // required
    public String user; // required
    public ezbake.base.thrift.DateTime timeStamp; // required

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements org.apache.thrift.TFieldIdEnum {
        NAME((short) 1, "name"), ID((short) 2, "id"), RETENTION_DURATION_SECONDS((short) 3,
                "retentionDurationSeconds"), MAXIMUM_EXECUTION_PERIOD((short) 4,
                        "maximumExecutionPeriod"), APPLICATION((short) 5,
                                "application"), USER((short) 6, "user"), TIME_STAMP((short) 7, "timeStamp");

        private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

        static {
            for (_Fields field : EnumSet.allOf(_Fields.class)) {
                byName.put(field.getFieldName(), field);
            }
        }

        /**
         * Find the _Fields constant that matches fieldId, or null if its not found.
         */
        public static _Fields findByThriftId(int fieldId) {
            switch (fieldId) {
            case 1: // NAME
                return NAME;
            case 2: // ID
                return ID;
            case 3: // RETENTION_DURATION_SECONDS
                return RETENTION_DURATION_SECONDS;
            case 4: // MAXIMUM_EXECUTION_PERIOD
                return MAXIMUM_EXECUTION_PERIOD;
            case 5: // APPLICATION
                return APPLICATION;
            case 6: // USER
                return USER;
            case 7: // TIME_STAMP
                return TIME_STAMP;
            default:
                return null;
            }
        }

        /**
         * Find the _Fields constant that matches fieldId, throwing an exception
         * if it is not found.
         */
        public static _Fields findByThriftIdOrThrow(int fieldId) {
            _Fields fields = findByThriftId(fieldId);
            if (fields == null)
                throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
            return fields;
        }

        /**
         * Find the _Fields constant that matches name, or null if its not found.
         */
        public static _Fields findByName(String name) {
            return byName.get(name);
        }

        private final short _thriftId;
        private final String _fieldName;

        _Fields(short thriftId, String fieldName) {
            _thriftId = thriftId;
            _fieldName = fieldName;
        }

        public short getThriftFieldId() {
            return _thriftId;
        }

        public String getFieldName() {
            return _fieldName;
        }
    }

    // isset id assignments
    private static final int __ID_ISSET_ID = 0;
    private static final int __RETENTIONDURATIONSECONDS_ISSET_ID = 1;
    private static final int __MAXIMUMEXECUTIONPERIOD_ISSET_ID = 2;
    private byte __isset_bitfield = 0;
    public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
    static {
        Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(
                _Fields.class);
        tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name",
                org.apache.thrift.TFieldRequirementType.REQUIRED,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        tmpMap.put(_Fields.ID,
                new org.apache.thrift.meta_data.FieldMetaData("id",
                        org.apache.thrift.TFieldRequirementType.REQUIRED,
                        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
        tmpMap.put(_Fields.RETENTION_DURATION_SECONDS,
                new org.apache.thrift.meta_data.FieldMetaData("retentionDurationSeconds",
                        org.apache.thrift.TFieldRequirementType.REQUIRED,
                        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
        tmpMap.put(_Fields.MAXIMUM_EXECUTION_PERIOD,
                new org.apache.thrift.meta_data.FieldMetaData("maximumExecutionPeriod",
                        org.apache.thrift.TFieldRequirementType.REQUIRED,
                        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
        tmpMap.put(_Fields.APPLICATION, new org.apache.thrift.meta_data.FieldMetaData("application",
                org.apache.thrift.TFieldRequirementType.REQUIRED,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        tmpMap.put(_Fields.USER, new org.apache.thrift.meta_data.FieldMetaData("user",
                org.apache.thrift.TFieldRequirementType.REQUIRED,
                new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
        tmpMap.put(_Fields.TIME_STAMP,
                new org.apache.thrift.meta_data.FieldMetaData("timeStamp",
                        org.apache.thrift.TFieldRequirementType.REQUIRED,
                        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT,
                                ezbake.base.thrift.DateTime.class)));
        metaDataMap = Collections.unmodifiableMap(tmpMap);
        org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AgeOffRule.class, metaDataMap);
    }

    public AgeOffRule() {
    }

    public AgeOffRule(String name, long id, long retentionDurationSeconds, int maximumExecutionPeriod,
            String application, String user, ezbake.base.thrift.DateTime timeStamp) {
        this();
        this.name = name;
        this.id = id;
        setIdIsSet(true);
        this.retentionDurationSeconds = retentionDurationSeconds;
        setRetentionDurationSecondsIsSet(true);
        this.maximumExecutionPeriod = maximumExecutionPeriod;
        setMaximumExecutionPeriodIsSet(true);
        this.application = application;
        this.user = user;
        this.timeStamp = timeStamp;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public AgeOffRule(AgeOffRule other) {
        __isset_bitfield = other.__isset_bitfield;
        if (other.isSetName()) {
            this.name = other.name;
        }
        this.id = other.id;
        this.retentionDurationSeconds = other.retentionDurationSeconds;
        this.maximumExecutionPeriod = other.maximumExecutionPeriod;
        if (other.isSetApplication()) {
            this.application = other.application;
        }
        if (other.isSetUser()) {
            this.user = other.user;
        }
        if (other.isSetTimeStamp()) {
            this.timeStamp = new ezbake.base.thrift.DateTime(other.timeStamp);
        }
    }

    public AgeOffRule deepCopy() {
        return new AgeOffRule(this);
    }

    @Override
    public void clear() {
        this.name = null;
        setIdIsSet(false);
        this.id = 0;
        setRetentionDurationSecondsIsSet(false);
        this.retentionDurationSeconds = 0;
        setMaximumExecutionPeriodIsSet(false);
        this.maximumExecutionPeriod = 0;
        this.application = null;
        this.user = null;
        this.timeStamp = null;
    }

    public String getName() {
        return this.name;
    }

    public AgeOffRule setName(String name) {
        this.name = name;
        return this;
    }

    public void unsetName() {
        this.name = null;
    }

    /** Returns true if field name is set (has been assigned a value) and false otherwise */
    public boolean isSetName() {
        return this.name != null;
    }

    public void setNameIsSet(boolean value) {
        if (!value) {
            this.name = null;
        }
    }

    public long getId() {
        return this.id;
    }

    public AgeOffRule setId(long id) {
        this.id = id;
        setIdIsSet(true);
        return this;
    }

    public void unsetId() {
        __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ID_ISSET_ID);
    }

    /** Returns true if field id is set (has been assigned a value) and false otherwise */
    public boolean isSetId() {
        return EncodingUtils.testBit(__isset_bitfield, __ID_ISSET_ID);
    }

    public void setIdIsSet(boolean value) {
        __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ID_ISSET_ID, value);
    }

    public long getRetentionDurationSeconds() {
        return this.retentionDurationSeconds;
    }

    public AgeOffRule setRetentionDurationSeconds(long retentionDurationSeconds) {
        this.retentionDurationSeconds = retentionDurationSeconds;
        setRetentionDurationSecondsIsSet(true);
        return this;
    }

    public void unsetRetentionDurationSeconds() {
        __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __RETENTIONDURATIONSECONDS_ISSET_ID);
    }

    /** Returns true if field retentionDurationSeconds is set (has been assigned a value) and false otherwise */
    public boolean isSetRetentionDurationSeconds() {
        return EncodingUtils.testBit(__isset_bitfield, __RETENTIONDURATIONSECONDS_ISSET_ID);
    }

    public void setRetentionDurationSecondsIsSet(boolean value) {
        __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __RETENTIONDURATIONSECONDS_ISSET_ID, value);
    }

    public int getMaximumExecutionPeriod() {
        return this.maximumExecutionPeriod;
    }

    public AgeOffRule setMaximumExecutionPeriod(int maximumExecutionPeriod) {
        this.maximumExecutionPeriod = maximumExecutionPeriod;
        setMaximumExecutionPeriodIsSet(true);
        return this;
    }

    public void unsetMaximumExecutionPeriod() {
        __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MAXIMUMEXECUTIONPERIOD_ISSET_ID);
    }

    /** Returns true if field maximumExecutionPeriod is set (has been assigned a value) and false otherwise */
    public boolean isSetMaximumExecutionPeriod() {
        return EncodingUtils.testBit(__isset_bitfield, __MAXIMUMEXECUTIONPERIOD_ISSET_ID);
    }

    public void setMaximumExecutionPeriodIsSet(boolean value) {
        __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MAXIMUMEXECUTIONPERIOD_ISSET_ID, value);
    }

    public String getApplication() {
        return this.application;
    }

    public AgeOffRule setApplication(String application) {
        this.application = application;
        return this;
    }

    public void unsetApplication() {
        this.application = null;
    }

    /** Returns true if field application is set (has been assigned a value) and false otherwise */
    public boolean isSetApplication() {
        return this.application != null;
    }

    public void setApplicationIsSet(boolean value) {
        if (!value) {
            this.application = null;
        }
    }

    public String getUser() {
        return this.user;
    }

    public AgeOffRule setUser(String user) {
        this.user = user;
        return this;
    }

    public void unsetUser() {
        this.user = null;
    }

    /** Returns true if field user is set (has been assigned a value) and false otherwise */
    public boolean isSetUser() {
        return this.user != null;
    }

    public void setUserIsSet(boolean value) {
        if (!value) {
            this.user = null;
        }
    }

    public ezbake.base.thrift.DateTime getTimeStamp() {
        return this.timeStamp;
    }

    public AgeOffRule setTimeStamp(ezbake.base.thrift.DateTime timeStamp) {
        this.timeStamp = timeStamp;
        return this;
    }

    public void unsetTimeStamp() {
        this.timeStamp = null;
    }

    /** Returns true if field timeStamp is set (has been assigned a value) and false otherwise */
    public boolean isSetTimeStamp() {
        return this.timeStamp != null;
    }

    public void setTimeStampIsSet(boolean value) {
        if (!value) {
            this.timeStamp = null;
        }
    }

    public void setFieldValue(_Fields field, Object value) {
        switch (field) {
        case NAME:
            if (value == null) {
                unsetName();
            } else {
                setName((String) value);
            }
            break;

        case ID:
            if (value == null) {
                unsetId();
            } else {
                setId((Long) value);
            }
            break;

        case RETENTION_DURATION_SECONDS:
            if (value == null) {
                unsetRetentionDurationSeconds();
            } else {
                setRetentionDurationSeconds((Long) value);
            }
            break;

        case MAXIMUM_EXECUTION_PERIOD:
            if (value == null) {
                unsetMaximumExecutionPeriod();
            } else {
                setMaximumExecutionPeriod((Integer) value);
            }
            break;

        case APPLICATION:
            if (value == null) {
                unsetApplication();
            } else {
                setApplication((String) value);
            }
            break;

        case USER:
            if (value == null) {
                unsetUser();
            } else {
                setUser((String) value);
            }
            break;

        case TIME_STAMP:
            if (value == null) {
                unsetTimeStamp();
            } else {
                setTimeStamp((ezbake.base.thrift.DateTime) value);
            }
            break;

        }
    }

    public Object getFieldValue(_Fields field) {
        switch (field) {
        case NAME:
            return getName();

        case ID:
            return Long.valueOf(getId());

        case RETENTION_DURATION_SECONDS:
            return Long.valueOf(getRetentionDurationSeconds());

        case MAXIMUM_EXECUTION_PERIOD:
            return Integer.valueOf(getMaximumExecutionPeriod());

        case APPLICATION:
            return getApplication();

        case USER:
            return getUser();

        case TIME_STAMP:
            return getTimeStamp();

        }
        throw new IllegalStateException();
    }

    /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
    public boolean isSet(_Fields field) {
        if (field == null) {
            throw new IllegalArgumentException();
        }

        switch (field) {
        case NAME:
            return isSetName();
        case ID:
            return isSetId();
        case RETENTION_DURATION_SECONDS:
            return isSetRetentionDurationSeconds();
        case MAXIMUM_EXECUTION_PERIOD:
            return isSetMaximumExecutionPeriod();
        case APPLICATION:
            return isSetApplication();
        case USER:
            return isSetUser();
        case TIME_STAMP:
            return isSetTimeStamp();
        }
        throw new IllegalStateException();
    }

    @Override
    public boolean equals(Object that) {
        if (that == null)
            return false;
        if (that instanceof AgeOffRule)
            return this.equals((AgeOffRule) that);
        return false;
    }

    public boolean equals(AgeOffRule that) {
        if (that == null)
            return false;

        boolean this_present_name = true && this.isSetName();
        boolean that_present_name = true && that.isSetName();
        if (this_present_name || that_present_name) {
            if (!(this_present_name && that_present_name))
                return false;
            if (!this.name.equals(that.name))
                return false;
        }

        boolean this_present_id = true;
        boolean that_present_id = true;
        if (this_present_id || that_present_id) {
            if (!(this_present_id && that_present_id))
                return false;
            if (this.id != that.id)
                return false;
        }

        boolean this_present_retentionDurationSeconds = true;
        boolean that_present_retentionDurationSeconds = true;
        if (this_present_retentionDurationSeconds || that_present_retentionDurationSeconds) {
            if (!(this_present_retentionDurationSeconds && that_present_retentionDurationSeconds))
                return false;
            if (this.retentionDurationSeconds != that.retentionDurationSeconds)
                return false;
        }

        boolean this_present_maximumExecutionPeriod = true;
        boolean that_present_maximumExecutionPeriod = true;
        if (this_present_maximumExecutionPeriod || that_present_maximumExecutionPeriod) {
            if (!(this_present_maximumExecutionPeriod && that_present_maximumExecutionPeriod))
                return false;
            if (this.maximumExecutionPeriod != that.maximumExecutionPeriod)
                return false;
        }

        boolean this_present_application = true && this.isSetApplication();
        boolean that_present_application = true && that.isSetApplication();
        if (this_present_application || that_present_application) {
            if (!(this_present_application && that_present_application))
                return false;
            if (!this.application.equals(that.application))
                return false;
        }

        boolean this_present_user = true && this.isSetUser();
        boolean that_present_user = true && that.isSetUser();
        if (this_present_user || that_present_user) {
            if (!(this_present_user && that_present_user))
                return false;
            if (!this.user.equals(that.user))
                return false;
        }

        boolean this_present_timeStamp = true && this.isSetTimeStamp();
        boolean that_present_timeStamp = true && that.isSetTimeStamp();
        if (this_present_timeStamp || that_present_timeStamp) {
            if (!(this_present_timeStamp && that_present_timeStamp))
                return false;
            if (!this.timeStamp.equals(that.timeStamp))
                return false;
        }

        return true;
    }

    @Override
    public int hashCode() {
        HashCodeBuilder builder = new HashCodeBuilder();

        boolean present_name = true && (isSetName());
        builder.append(present_name);
        if (present_name)
            builder.append(name);

        boolean present_id = true;
        builder.append(present_id);
        if (present_id)
            builder.append(id);

        boolean present_retentionDurationSeconds = true;
        builder.append(present_retentionDurationSeconds);
        if (present_retentionDurationSeconds)
            builder.append(retentionDurationSeconds);

        boolean present_maximumExecutionPeriod = true;
        builder.append(present_maximumExecutionPeriod);
        if (present_maximumExecutionPeriod)
            builder.append(maximumExecutionPeriod);

        boolean present_application = true && (isSetApplication());
        builder.append(present_application);
        if (present_application)
            builder.append(application);

        boolean present_user = true && (isSetUser());
        builder.append(present_user);
        if (present_user)
            builder.append(user);

        boolean present_timeStamp = true && (isSetTimeStamp());
        builder.append(present_timeStamp);
        if (present_timeStamp)
            builder.append(timeStamp);

        return builder.toHashCode();
    }

    @Override
    public int compareTo(AgeOffRule other) {
        if (!getClass().equals(other.getClass())) {
            return getClass().getName().compareTo(other.getClass().getName());
        }

        int lastComparison = 0;

        lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetName()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetId()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetRetentionDurationSeconds())
                .compareTo(other.isSetRetentionDurationSeconds());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetRetentionDurationSeconds()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.retentionDurationSeconds,
                    other.retentionDurationSeconds);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetMaximumExecutionPeriod())
                .compareTo(other.isSetMaximumExecutionPeriod());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetMaximumExecutionPeriod()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.maximumExecutionPeriod,
                    other.maximumExecutionPeriod);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetApplication()).compareTo(other.isSetApplication());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetApplication()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.application, other.application);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetUser()).compareTo(other.isSetUser());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetUser()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.user, other.user);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        lastComparison = Boolean.valueOf(isSetTimeStamp()).compareTo(other.isSetTimeStamp());
        if (lastComparison != 0) {
            return lastComparison;
        }
        if (isSetTimeStamp()) {
            lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.timeStamp, other.timeStamp);
            if (lastComparison != 0) {
                return lastComparison;
            }
        }
        return 0;
    }

    public _Fields fieldForId(int fieldId) {
        return _Fields.findByThriftId(fieldId);
    }

    public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
        schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
        schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder("AgeOffRule(");
        boolean first = true;

        sb.append("name:");
        if (this.name == null) {
            sb.append("null");
        } else {
            sb.append(this.name);
        }
        first = false;
        if (!first)
            sb.append(", ");
        sb.append("id:");
        sb.append(this.id);
        first = false;
        if (!first)
            sb.append(", ");
        sb.append("retentionDurationSeconds:");
        sb.append(this.retentionDurationSeconds);
        first = false;
        if (!first)
            sb.append(", ");
        sb.append("maximumExecutionPeriod:");
        sb.append(this.maximumExecutionPeriod);
        first = false;
        if (!first)
            sb.append(", ");
        sb.append("application:");
        if (this.application == null) {
            sb.append("null");
        } else {
            sb.append(this.application);
        }
        first = false;
        if (!first)
            sb.append(", ");
        sb.append("user:");
        if (this.user == null) {
            sb.append("null");
        } else {
            sb.append(this.user);
        }
        first = false;
        if (!first)
            sb.append(", ");
        sb.append("timeStamp:");
        if (this.timeStamp == null) {
            sb.append("null");
        } else {
            sb.append(this.timeStamp);
        }
        first = false;
        sb.append(")");
        return sb.toString();
    }

    public void validate() throws org.apache.thrift.TException {
        // check for required fields
        if (name == null) {
            throw new org.apache.thrift.protocol.TProtocolException(
                    "Required field 'name' was not present! Struct: " + toString());
        }
        // alas, we cannot check 'id' because it's a primitive and you chose the non-beans generator.
        // alas, we cannot check 'retentionDurationSeconds' because it's a primitive and you chose the non-beans generator.
        // alas, we cannot check 'maximumExecutionPeriod' because it's a primitive and you chose the non-beans generator.
        if (application == null) {
            throw new org.apache.thrift.protocol.TProtocolException(
                    "Required field 'application' was not present! Struct: " + toString());
        }
        if (user == null) {
            throw new org.apache.thrift.protocol.TProtocolException(
                    "Required field 'user' was not present! Struct: " + toString());
        }
        if (timeStamp == null) {
            throw new org.apache.thrift.protocol.TProtocolException(
                    "Required field 'timeStamp' was not present! Struct: " + toString());
        }
        // check for sub-struct validity
        if (timeStamp != null) {
            timeStamp.validate();
        }
    }

    private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
        try {
            write(new org.apache.thrift.protocol.TCompactProtocol(
                    new org.apache.thrift.transport.TIOStreamTransport(out)));
        } catch (org.apache.thrift.TException te) {
            throw new java.io.IOException(te);
        }
    }

    private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
        try {
            // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
            __isset_bitfield = 0;
            read(new org.apache.thrift.protocol.TCompactProtocol(
                    new org.apache.thrift.transport.TIOStreamTransport(in)));
        } catch (org.apache.thrift.TException te) {
            throw new java.io.IOException(te);
        }
    }

    private static class AgeOffRuleStandardSchemeFactory implements SchemeFactory {
        public AgeOffRuleStandardScheme getScheme() {
            return new AgeOffRuleStandardScheme();
        }
    }

    private static class AgeOffRuleStandardScheme extends StandardScheme<AgeOffRule> {

        public void read(org.apache.thrift.protocol.TProtocol iprot, AgeOffRule struct)
                throws org.apache.thrift.TException {
            org.apache.thrift.protocol.TField schemeField;
            iprot.readStructBegin();
            while (true) {
                schemeField = iprot.readFieldBegin();
                if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
                    break;
                }
                switch (schemeField.id) {
                case 1: // NAME
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                        struct.name = iprot.readString();
                        struct.setNameIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 2: // ID
                    if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
                        struct.id = iprot.readI64();
                        struct.setIdIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 3: // RETENTION_DURATION_SECONDS
                    if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
                        struct.retentionDurationSeconds = iprot.readI64();
                        struct.setRetentionDurationSecondsIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 4: // MAXIMUM_EXECUTION_PERIOD
                    if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
                        struct.maximumExecutionPeriod = iprot.readI32();
                        struct.setMaximumExecutionPeriodIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 5: // APPLICATION
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                        struct.application = iprot.readString();
                        struct.setApplicationIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 6: // USER
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
                        struct.user = iprot.readString();
                        struct.setUserIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                case 7: // TIME_STAMP
                    if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
                        struct.timeStamp = new ezbake.base.thrift.DateTime();
                        struct.timeStamp.read(iprot);
                        struct.setTimeStampIsSet(true);
                    } else {
                        org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                    }
                    break;
                default:
                    org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
                }
                iprot.readFieldEnd();
            }
            iprot.readStructEnd();

            // check for required fields of primitive type, which can't be checked in the validate method
            if (!struct.isSetId()) {
                throw new org.apache.thrift.protocol.TProtocolException(
                        "Required field 'id' was not found in serialized data! Struct: " + toString());
            }
            if (!struct.isSetRetentionDurationSeconds()) {
                throw new org.apache.thrift.protocol.TProtocolException(
                        "Required field 'retentionDurationSeconds' was not found in serialized data! Struct: "
                                + toString());
            }
            if (!struct.isSetMaximumExecutionPeriod()) {
                throw new org.apache.thrift.protocol.TProtocolException(
                        "Required field 'maximumExecutionPeriod' was not found in serialized data! Struct: "
                                + toString());
            }
            struct.validate();
        }

        public void write(org.apache.thrift.protocol.TProtocol oprot, AgeOffRule struct)
                throws org.apache.thrift.TException {
            struct.validate();

            oprot.writeStructBegin(STRUCT_DESC);
            if (struct.name != null) {
                oprot.writeFieldBegin(NAME_FIELD_DESC);
                oprot.writeString(struct.name);
                oprot.writeFieldEnd();
            }
            oprot.writeFieldBegin(ID_FIELD_DESC);
            oprot.writeI64(struct.id);
            oprot.writeFieldEnd();
            oprot.writeFieldBegin(RETENTION_DURATION_SECONDS_FIELD_DESC);
            oprot.writeI64(struct.retentionDurationSeconds);
            oprot.writeFieldEnd();
            oprot.writeFieldBegin(MAXIMUM_EXECUTION_PERIOD_FIELD_DESC);
            oprot.writeI32(struct.maximumExecutionPeriod);
            oprot.writeFieldEnd();
            if (struct.application != null) {
                oprot.writeFieldBegin(APPLICATION_FIELD_DESC);
                oprot.writeString(struct.application);
                oprot.writeFieldEnd();
            }
            if (struct.user != null) {
                oprot.writeFieldBegin(USER_FIELD_DESC);
                oprot.writeString(struct.user);
                oprot.writeFieldEnd();
            }
            if (struct.timeStamp != null) {
                oprot.writeFieldBegin(TIME_STAMP_FIELD_DESC);
                struct.timeStamp.write(oprot);
                oprot.writeFieldEnd();
            }
            oprot.writeFieldStop();
            oprot.writeStructEnd();
        }

    }

    private static class AgeOffRuleTupleSchemeFactory implements SchemeFactory {
        public AgeOffRuleTupleScheme getScheme() {
            return new AgeOffRuleTupleScheme();
        }
    }

    private static class AgeOffRuleTupleScheme extends TupleScheme<AgeOffRule> {

        @Override
        public void write(org.apache.thrift.protocol.TProtocol prot, AgeOffRule struct)
                throws org.apache.thrift.TException {
            TTupleProtocol oprot = (TTupleProtocol) prot;
            oprot.writeString(struct.name);
            oprot.writeI64(struct.id);
            oprot.writeI64(struct.retentionDurationSeconds);
            oprot.writeI32(struct.maximumExecutionPeriod);
            oprot.writeString(struct.application);
            oprot.writeString(struct.user);
            struct.timeStamp.write(oprot);
        }

        @Override
        public void read(org.apache.thrift.protocol.TProtocol prot, AgeOffRule struct)
                throws org.apache.thrift.TException {
            TTupleProtocol iprot = (TTupleProtocol) prot;
            struct.name = iprot.readString();
            struct.setNameIsSet(true);
            struct.id = iprot.readI64();
            struct.setIdIsSet(true);
            struct.retentionDurationSeconds = iprot.readI64();
            struct.setRetentionDurationSecondsIsSet(true);
            struct.maximumExecutionPeriod = iprot.readI32();
            struct.setMaximumExecutionPeriodIsSet(true);
            struct.application = iprot.readString();
            struct.setApplicationIsSet(true);
            struct.user = iprot.readString();
            struct.setUserIsSet(true);
            struct.timeStamp = new ezbake.base.thrift.DateTime();
            struct.timeStamp.read(iprot);
            struct.setTimeStampIsSet(true);
        }
    }

}