com.clover.sdk.v3.billing.DeviceCountInfo.java Source code

Java tutorial

Introduction

Here is the source code for com.clover.sdk.v3.billing.DeviceCountInfo.java

Source

/**
 * Autogenerated by Avro
 * 
 * DO NOT EDIT DIRECTLY
 */

/*
 * Copyright (C) 2013 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.
 */

package com.clover.sdk.v3.billing;

import com.clover.sdk.GenericClient;

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

    public java.lang.Long getTotalDevices() {
        return genClient.cacheGet(CacheKey.totalDevices);
    }

    public java.lang.Long getNumStations() {
        return genClient.cacheGet(CacheKey.numStations);
    }

    public java.lang.Long getNumMobiles() {
        return genClient.cacheGet(CacheKey.numMobiles);
    }

    public java.lang.Long getNumMinis() {
        return genClient.cacheGet(CacheKey.numMinis);
    }

    private enum CacheKey implements com.clover.sdk.ValueExtractorEnum<DeviceCountInfo> {
        totalDevices {
            @Override
            public Object extractValue(DeviceCountInfo instance) {
                return instance.genClient.extractOther("totalDevices", java.lang.Long.class);
            }
        },
        numStations {
            @Override
            public Object extractValue(DeviceCountInfo instance) {
                return instance.genClient.extractOther("numStations", java.lang.Long.class);
            }
        },
        numMobiles {
            @Override
            public Object extractValue(DeviceCountInfo instance) {
                return instance.genClient.extractOther("numMobiles", java.lang.Long.class);
            }
        },
        numMinis {
            @Override
            public Object extractValue(DeviceCountInfo instance) {
                return instance.genClient.extractOther("numMinis", java.lang.Long.class);
            }
        },;
    }

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

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

    /**
     * Constructs a new instance from the given JSON String.
     */
    public DeviceCountInfo(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 DeviceCountInfo(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 DeviceCountInfo(DeviceCountInfo 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 'totalDevices' field is set and is not null */
    public boolean isNotNullTotalDevices() {
        return genClient.cacheValueIsNotNull(CacheKey.totalDevices);
    }

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

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

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

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

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

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

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

    /**
     * Sets the field 'totalDevices'.
     */
    public DeviceCountInfo setTotalDevices(java.lang.Long totalDevices) {
        return genClient.setOther(totalDevices, CacheKey.totalDevices);
    }

    /**
     * Sets the field 'numStations'.
     */
    public DeviceCountInfo setNumStations(java.lang.Long numStations) {
        return genClient.setOther(numStations, CacheKey.numStations);
    }

    /**
     * Sets the field 'numMobiles'.
     */
    public DeviceCountInfo setNumMobiles(java.lang.Long numMobiles) {
        return genClient.setOther(numMobiles, CacheKey.numMobiles);
    }

    /**
     * Sets the field 'numMinis'.
     */
    public DeviceCountInfo setNumMinis(java.lang.Long numMinis) {
        return genClient.setOther(numMinis, CacheKey.numMinis);
    }

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

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

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

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

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

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

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

    public interface Constraints {

        public static final boolean TOTALDEVICES_IS_REQUIRED = false;

        public static final boolean NUMSTATIONS_IS_REQUIRED = false;

        public static final boolean NUMMOBILES_IS_REQUIRED = false;

        public static final boolean NUMMINIS_IS_REQUIRED = false;

    }

}