com.clover.sdk.v3.payments.BatchTotalStats.java Source code

Java tutorial

Introduction

Here is the source code for com.clover.sdk.v3.payments.BatchTotalStats.java

Source

/**
 * Copyright (C) 2015 Clover Network, Inc.
 *
 * 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 Avro
 * 
 * DO NOT EDIT DIRECTLY
 */

package com.clover.sdk.v3.payments;

import com.clover.sdk.GenericClient;

@SuppressWarnings("all")
public final class BatchTotalStats
        implements android.os.Parcelable, com.clover.sdk.v3.Validator, com.clover.sdk.JSONifiable {

    public com.clover.sdk.v3.payments.BatchTotalType getSales() {
        return genClient.cacheGet(CacheKey.sales);
    }

    public com.clover.sdk.v3.payments.BatchTotalType getRefunds() {
        return genClient.cacheGet(CacheKey.refunds);
    }

    public com.clover.sdk.v3.payments.BatchTotalType getNet() {
        return genClient.cacheGet(CacheKey.net);
    }

    public com.clover.sdk.v3.payments.BatchTotalType getGiftCardLoads() {
        return genClient.cacheGet(CacheKey.giftCardLoads);
    }

    public com.clover.sdk.v3.payments.BatchTotalType getGiftCardCashOuts() {
        return genClient.cacheGet(CacheKey.giftCardCashOuts);
    }

    public com.clover.sdk.v3.payments.BatchTotalType getTax() {
        return genClient.cacheGet(CacheKey.tax);
    }

    public com.clover.sdk.v3.payments.BatchTotalType getTips() {
        return genClient.cacheGet(CacheKey.tips);
    }

    private enum CacheKey implements com.clover.sdk.ValueExtractorEnum<BatchTotalStats> {
        sales {
            @Override
            public Object extractValue(BatchTotalStats instance) {
                return instance.genClient.extractRecord("sales",
                        com.clover.sdk.v3.payments.BatchTotalType.JSON_CREATOR);
            }
        },
        refunds {
            @Override
            public Object extractValue(BatchTotalStats instance) {
                return instance.genClient.extractRecord("refunds",
                        com.clover.sdk.v3.payments.BatchTotalType.JSON_CREATOR);
            }
        },
        net {
            @Override
            public Object extractValue(BatchTotalStats instance) {
                return instance.genClient.extractRecord("net",
                        com.clover.sdk.v3.payments.BatchTotalType.JSON_CREATOR);
            }
        },
        giftCardLoads {
            @Override
            public Object extractValue(BatchTotalStats instance) {
                return instance.genClient.extractRecord("giftCardLoads",
                        com.clover.sdk.v3.payments.BatchTotalType.JSON_CREATOR);
            }
        },
        giftCardCashOuts {
            @Override
            public Object extractValue(BatchTotalStats instance) {
                return instance.genClient.extractRecord("giftCardCashOuts",
                        com.clover.sdk.v3.payments.BatchTotalType.JSON_CREATOR);
            }
        },
        tax {
            @Override
            public Object extractValue(BatchTotalStats instance) {
                return instance.genClient.extractRecord("tax",
                        com.clover.sdk.v3.payments.BatchTotalType.JSON_CREATOR);
            }
        },
        tips {
            @Override
            public Object extractValue(BatchTotalStats instance) {
                return instance.genClient.extractRecord("tips",
                        com.clover.sdk.v3.payments.BatchTotalType.JSON_CREATOR);
            }
        },;
    }

    private GenericClient<BatchTotalStats> genClient = new GenericClient<BatchTotalStats>(this);

    /**
     * Constructs a new empty instance.
     */
    public BatchTotalStats() {
    }

    /**
     * Constructs a new instance from the given JSON String.
     */
    public BatchTotalStats(String json) throws IllegalArgumentException {
        try {
            genClient.setJsonObject(new org.json.JSONObject(json));
        } catch (org.json.JSONException e) {
            throw new IllegalArgumentException("invalid json", e);
        }
    }

    /**
     * Construct a new instance backed by the given JSONObject, the parameter is not copied so changes to it will be
     * reflected in this instance and vice-versa.
     */
    public BatchTotalStats(org.json.JSONObject jsonObject) {
        genClient.setJsonObject(jsonObject);
    }

    /**
     * Constructs a new instance that is a deep copy of the source instance. It does not copy the bundle or changelog.
     */
    public BatchTotalStats(BatchTotalStats src) {
        if (src.genClient.getJsonObject() != null) {
            genClient.setJsonObject(com.clover.sdk.v3.JsonHelper.deepCopy(src.genClient.getJSONObject()));
        }
    }

    /**
     * Returns the internal JSONObject backing this instance, the return value is not a copy so changes to it will be
     * reflected in this instance and vice-versa.
     */
    public org.json.JSONObject getJSONObject() {
        return genClient.getJSONObject();
    }

    @Override
    public void validate() {
    }

    /** Checks whether the 'sales' field is set and is not null */
    public boolean isNotNullSales() {
        return genClient.cacheValueIsNotNull(CacheKey.sales);
    }

    /** Checks whether the 'refunds' field is set and is not null */
    public boolean isNotNullRefunds() {
        return genClient.cacheValueIsNotNull(CacheKey.refunds);
    }

    /** Checks whether the 'net' field is set and is not null */
    public boolean isNotNullNet() {
        return genClient.cacheValueIsNotNull(CacheKey.net);
    }

    /** Checks whether the 'giftCardLoads' field is set and is not null */
    public boolean isNotNullGiftCardLoads() {
        return genClient.cacheValueIsNotNull(CacheKey.giftCardLoads);
    }

    /** Checks whether the 'giftCardCashOuts' field is set and is not null */
    public boolean isNotNullGiftCardCashOuts() {
        return genClient.cacheValueIsNotNull(CacheKey.giftCardCashOuts);
    }

    /** Checks whether the 'tax' field is set and is not null */
    public boolean isNotNullTax() {
        return genClient.cacheValueIsNotNull(CacheKey.tax);
    }

    /** Checks whether the 'tips' field is set and is not null */
    public boolean isNotNullTips() {
        return genClient.cacheValueIsNotNull(CacheKey.tips);
    }

    /** Checks whether the 'sales' field has been set, however the value could be null */
    public boolean hasSales() {
        return genClient.cacheHasKey(CacheKey.sales);
    }

    /** Checks whether the 'refunds' field has been set, however the value could be null */
    public boolean hasRefunds() {
        return genClient.cacheHasKey(CacheKey.refunds);
    }

    /** Checks whether the 'net' field has been set, however the value could be null */
    public boolean hasNet() {
        return genClient.cacheHasKey(CacheKey.net);
    }

    /** Checks whether the 'giftCardLoads' field has been set, however the value could be null */
    public boolean hasGiftCardLoads() {
        return genClient.cacheHasKey(CacheKey.giftCardLoads);
    }

    /** Checks whether the 'giftCardCashOuts' field has been set, however the value could be null */
    public boolean hasGiftCardCashOuts() {
        return genClient.cacheHasKey(CacheKey.giftCardCashOuts);
    }

    /** Checks whether the 'tax' field has been set, however the value could be null */
    public boolean hasTax() {
        return genClient.cacheHasKey(CacheKey.tax);
    }

    /** Checks whether the 'tips' field has been set, however the value could be null */
    public boolean hasTips() {
        return genClient.cacheHasKey(CacheKey.tips);
    }

    /**
     * Sets the field 'sales'.
     *
     * The parameter is not copied so changes to it will be reflected in this instance and vice-versa.
     */
    public BatchTotalStats setSales(com.clover.sdk.v3.payments.BatchTotalType sales) {
        return genClient.setRecord(sales, CacheKey.sales);
    }

    /**
     * Sets the field 'refunds'.
     *
     * The parameter is not copied so changes to it will be reflected in this instance and vice-versa.
     */
    public BatchTotalStats setRefunds(com.clover.sdk.v3.payments.BatchTotalType refunds) {
        return genClient.setRecord(refunds, CacheKey.refunds);
    }

    /**
     * Sets the field 'net'.
     *
     * The parameter is not copied so changes to it will be reflected in this instance and vice-versa.
     */
    public BatchTotalStats setNet(com.clover.sdk.v3.payments.BatchTotalType net) {
        return genClient.setRecord(net, CacheKey.net);
    }

    /**
     * Sets the field 'giftCardLoads'.
     *
     * The parameter is not copied so changes to it will be reflected in this instance and vice-versa.
     */
    public BatchTotalStats setGiftCardLoads(com.clover.sdk.v3.payments.BatchTotalType giftCardLoads) {
        return genClient.setRecord(giftCardLoads, CacheKey.giftCardLoads);
    }

    /**
     * Sets the field 'giftCardCashOuts'.
     *
     * The parameter is not copied so changes to it will be reflected in this instance and vice-versa.
     */
    public BatchTotalStats setGiftCardCashOuts(com.clover.sdk.v3.payments.BatchTotalType giftCardCashOuts) {
        return genClient.setRecord(giftCardCashOuts, CacheKey.giftCardCashOuts);
    }

    /**
     * Sets the field 'tax'.
     *
     * The parameter is not copied so changes to it will be reflected in this instance and vice-versa.
     */
    public BatchTotalStats setTax(com.clover.sdk.v3.payments.BatchTotalType tax) {
        return genClient.setRecord(tax, CacheKey.tax);
    }

    /**
     * Sets the field 'tips'.
     *
     * The parameter is not copied so changes to it will be reflected in this instance and vice-versa.
     */
    public BatchTotalStats setTips(com.clover.sdk.v3.payments.BatchTotalType tips) {
        return genClient.setRecord(tips, CacheKey.tips);
    }

    /** Clears the 'sales' field, the 'has' method for this field will now return false */
    public void clearSales() {
        genClient.clear(CacheKey.sales);
    }

    /** Clears the 'refunds' field, the 'has' method for this field will now return false */
    public void clearRefunds() {
        genClient.clear(CacheKey.refunds);
    }

    /** Clears the 'net' field, the 'has' method for this field will now return false */
    public void clearNet() {
        genClient.clear(CacheKey.net);
    }

    /** Clears the 'giftCardLoads' field, the 'has' method for this field will now return false */
    public void clearGiftCardLoads() {
        genClient.clear(CacheKey.giftCardLoads);
    }

    /** Clears the 'giftCardCashOuts' field, the 'has' method for this field will now return false */
    public void clearGiftCardCashOuts() {
        genClient.clear(CacheKey.giftCardCashOuts);
    }

    /** Clears the 'tax' field, the 'has' method for this field will now return false */
    public void clearTax() {
        genClient.clear(CacheKey.tax);
    }

    /** Clears the 'tips' field, the 'has' method for this field will now return false */
    public void clearTips() {
        genClient.clear(CacheKey.tips);
    }

    /**
     * Returns true if this instance has any changes.
     */
    public boolean containsChanges() {
        return genClient.containsChanges();
    }

    /**
     * Reset the log of changes made to this instance, calling copyChanges() after this would return an empty instance.
     */
    public void resetChangeLog() {
        genClient.resetChangeLog();
    }

    /**
     * Create a copy of this instance that contains only fields that were set after the constructor was called.
     */
    public BatchTotalStats copyChanges() {
        BatchTotalStats copy = new BatchTotalStats();
        copy.mergeChanges(this);
        copy.resetChangeLog();
        return copy;
    }

    /**
     * Copy all the changed fields from the given source to this instance.
     */
    public void mergeChanges(BatchTotalStats src) {
        if (src.genClient.getChangeLog() != null) {
            genClient.mergeChanges(new BatchTotalStats(src).getJSONObject(), src.genClient);
        }
    }

    /**
     * Gets a Bundle which can be used to get and set data attached to this instance. The attached Bundle will be
     * parcelled but not jsonified.
     */
    public android.os.Bundle getBundle() {
        return genClient.getBundle();
    }

    @Override
    public String toString() {
        return genClient.toString();
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(android.os.Parcel dest, int flags) {
        genClient.writeToParcel(dest, flags);
    }

    public static final android.os.Parcelable.Creator<BatchTotalStats> CREATOR = new android.os.Parcelable.Creator<BatchTotalStats>() {
        @Override
        public BatchTotalStats createFromParcel(android.os.Parcel in) {
            BatchTotalStats instance = new BatchTotalStats(
                    com.clover.sdk.v3.JsonParcelHelper.ObjectWrapper.CREATOR.createFromParcel(in).unwrap());
            instance.genClient.setBundle(in.readBundle(getClass().getClassLoader()));
            instance.genClient.setChangeLog(in.readBundle());
            return instance;
        }

        @Override
        public BatchTotalStats[] newArray(int size) {
            return new BatchTotalStats[size];
        }
    };

    public static final com.clover.sdk.JSONifiable.Creator<BatchTotalStats> JSON_CREATOR = new com.clover.sdk.JSONifiable.Creator<BatchTotalStats>() {
        @Override
        public BatchTotalStats create(org.json.JSONObject jsonObject) {
            return new BatchTotalStats(jsonObject);
        }
    };

    public interface Constraints {

        public static final boolean SALES_IS_REQUIRED = false;

        public static final boolean REFUNDS_IS_REQUIRED = false;

        public static final boolean NET_IS_REQUIRED = false;

        public static final boolean GIFTCARDLOADS_IS_REQUIRED = false;

        public static final boolean GIFTCARDCASHOUTS_IS_REQUIRED = false;

        public static final boolean TAX_IS_REQUIRED = false;

        public static final boolean TIPS_IS_REQUIRED = false;

    }

}