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

Java tutorial

Introduction

Here is the source code for com.clover.sdk.v3.payments.ServerTotalStats.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 ServerTotalStats
        implements android.os.Parcelable, com.clover.sdk.v3.Validator, com.clover.sdk.JSONifiable {

    /**
     * Employee corresponding to these stats
     */
    public java.lang.String getEmployeeId() {
        return genClient.cacheGet(CacheKey.employeeId);
    }

    public java.lang.String getEmployeeName() {
        return genClient.cacheGet(CacheKey.employeeName);
    }

    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<ServerTotalStats> {
        employeeId {
            @Override
            public Object extractValue(ServerTotalStats instance) {
                return instance.genClient.extractOther("employeeId", java.lang.String.class);
            }
        },
        employeeName {
            @Override
            public Object extractValue(ServerTotalStats instance) {
                return instance.genClient.extractOther("employeeName", java.lang.String.class);
            }
        },
        sales {
            @Override
            public Object extractValue(ServerTotalStats instance) {
                return instance.genClient.extractRecord("sales",
                        com.clover.sdk.v3.payments.BatchTotalType.JSON_CREATOR);
            }
        },
        refunds {
            @Override
            public Object extractValue(ServerTotalStats instance) {
                return instance.genClient.extractRecord("refunds",
                        com.clover.sdk.v3.payments.BatchTotalType.JSON_CREATOR);
            }
        },
        net {
            @Override
            public Object extractValue(ServerTotalStats instance) {
                return instance.genClient.extractRecord("net",
                        com.clover.sdk.v3.payments.BatchTotalType.JSON_CREATOR);
            }
        },
        giftCardLoads {
            @Override
            public Object extractValue(ServerTotalStats instance) {
                return instance.genClient.extractRecord("giftCardLoads",
                        com.clover.sdk.v3.payments.BatchTotalType.JSON_CREATOR);
            }
        },
        giftCardCashOuts {
            @Override
            public Object extractValue(ServerTotalStats instance) {
                return instance.genClient.extractRecord("giftCardCashOuts",
                        com.clover.sdk.v3.payments.BatchTotalType.JSON_CREATOR);
            }
        },
        tax {
            @Override
            public Object extractValue(ServerTotalStats instance) {
                return instance.genClient.extractRecord("tax",
                        com.clover.sdk.v3.payments.BatchTotalType.JSON_CREATOR);
            }
        },
        tips {
            @Override
            public Object extractValue(ServerTotalStats instance) {
                return instance.genClient.extractRecord("tips",
                        com.clover.sdk.v3.payments.BatchTotalType.JSON_CREATOR);
            }
        },;
    }

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

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

    /**
     * Constructs a new instance from the given JSON String.
     */
    public ServerTotalStats(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 ServerTotalStats(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 ServerTotalStats(ServerTotalStats 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() {
        genClient.validateLength(getEmployeeId(), 13);
    }

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

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

    /** 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 'employeeId' field has been set, however the value could be null */
    public boolean hasEmployeeId() {
        return genClient.cacheHasKey(CacheKey.employeeId);
    }

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

    /** 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 'employeeId'.
     */
    public ServerTotalStats setEmployeeId(java.lang.String employeeId) {
        return genClient.setOther(employeeId, CacheKey.employeeId);
    }

    /**
     * Sets the field 'employeeName'.
     */
    public ServerTotalStats setEmployeeName(java.lang.String employeeName) {
        return genClient.setOther(employeeName, CacheKey.employeeName);
    }

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

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

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

    /** 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 ServerTotalStats copyChanges() {
        ServerTotalStats copy = new ServerTotalStats();
        copy.mergeChanges(this);
        copy.resetChangeLog();
        return copy;
    }

    /**
     * Copy all the changed fields from the given source to this instance.
     */
    public void mergeChanges(ServerTotalStats src) {
        if (src.genClient.getChangeLog() != null) {
            genClient.mergeChanges(new ServerTotalStats(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<ServerTotalStats> CREATOR = new android.os.Parcelable.Creator<ServerTotalStats>() {
        @Override
        public ServerTotalStats createFromParcel(android.os.Parcel in) {
            ServerTotalStats instance = new ServerTotalStats(
                    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 ServerTotalStats[] newArray(int size) {
            return new ServerTotalStats[size];
        }
    };

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

    public interface Constraints {

        public static final boolean EMPLOYEEID_IS_REQUIRED = false;
        public static final long EMPLOYEEID_MAX_LEN = 13;

        public static final boolean EMPLOYEENAME_IS_REQUIRED = false;

        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;

    }

}