com.amazonaws.services.devicefarm.model.Offering Maven / Gradle / Ivy
Show all versions of aws-java-sdk-devicefarm Show documentation
/*
 * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights
 * Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file 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.amazonaws.services.devicefarm.model;
import java.io.Serializable;
/**
 * 
 * Represents the metadata of a device offering.
 * 
 */
public class Offering implements Serializable, Cloneable {
    /**
     * 
     * The ID that corresponds to a device offering.
     * 
     */
    private String id;
    /**
     * 
     * A string describing the offering.
     * 
     */
    private String description;
    /**
     * 
     * The type of offering (e.g., "RECURRING") for a device.
     * 
     */
    private String type;
    /**
     * 
     * The platform of the device (e.g., ANDROID or IOS).
     * 
     */
    private String platform;
    /**
     * 
     * Specifies whether there are recurring charges for the offering.
     * 
     */
    private java.util.List recurringCharges;
    /**
     * 
     * The ID that corresponds to a device offering.
     * 
     * 
     * @param id
     *        The ID that corresponds to a device offering.
     */
    public void setId(String id) {
        this.id = id;
    }
    /**
     * 
     * The ID that corresponds to a device offering.
     * 
     * 
     * @return The ID that corresponds to a device offering.
     */
    public String getId() {
        return this.id;
    }
    /**
     * 
     * The ID that corresponds to a device offering.
     * 
     * 
     * @param id
     *        The ID that corresponds to a device offering.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Offering withId(String id) {
        setId(id);
        return this;
    }
    /**
     * 
     * A string describing the offering.
     * 
     * 
     * @param description
     *        A string describing the offering.
     */
    public void setDescription(String description) {
        this.description = description;
    }
    /**
     * 
     * A string describing the offering.
     * 
     * 
     * @return A string describing the offering.
     */
    public String getDescription() {
        return this.description;
    }
    /**
     * 
     * A string describing the offering.
     * 
     * 
     * @param description
     *        A string describing the offering.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Offering withDescription(String description) {
        setDescription(description);
        return this;
    }
    /**
     * 
     * The type of offering (e.g., "RECURRING") for a device.
     * 
     * 
     * @param type
     *        The type of offering (e.g., "RECURRING") for a device.
     * @see OfferingType
     */
    public void setType(String type) {
        this.type = type;
    }
    /**
     * 
     * The type of offering (e.g., "RECURRING") for a device.
     * 
     * 
     * @return The type of offering (e.g., "RECURRING") for a device.
     * @see OfferingType
     */
    public String getType() {
        return this.type;
    }
    /**
     * 
     * The type of offering (e.g., "RECURRING") for a device.
     * 
     * 
     * @param type
     *        The type of offering (e.g., "RECURRING") for a device.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see OfferingType
     */
    public Offering withType(String type) {
        setType(type);
        return this;
    }
    /**
     * 
     * The type of offering (e.g., "RECURRING") for a device.
     * 
     * 
     * @param type
     *        The type of offering (e.g., "RECURRING") for a device.
     * @see OfferingType
     */
    public void setType(OfferingType type) {
        this.type = type.toString();
    }
    /**
     * 
     * The type of offering (e.g., "RECURRING") for a device.
     * 
     * 
     * @param type
     *        The type of offering (e.g., "RECURRING") for a device.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see OfferingType
     */
    public Offering withType(OfferingType type) {
        setType(type);
        return this;
    }
    /**
     * 
     * The platform of the device (e.g., ANDROID or IOS).
     * 
     * 
     * @param platform
     *        The platform of the device (e.g., ANDROID or IOS).
     * @see DevicePlatform
     */
    public void setPlatform(String platform) {
        this.platform = platform;
    }
    /**
     * 
     * The platform of the device (e.g., ANDROID or IOS).
     * 
     * 
     * @return The platform of the device (e.g., ANDROID or IOS).
     * @see DevicePlatform
     */
    public String getPlatform() {
        return this.platform;
    }
    /**
     * 
     * The platform of the device (e.g., ANDROID or IOS).
     * 
     * 
     * @param platform
     *        The platform of the device (e.g., ANDROID or IOS).
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see DevicePlatform
     */
    public Offering withPlatform(String platform) {
        setPlatform(platform);
        return this;
    }
    /**
     * 
     * The platform of the device (e.g., ANDROID or IOS).
     * 
     * 
     * @param platform
     *        The platform of the device (e.g., ANDROID or IOS).
     * @see DevicePlatform
     */
    public void setPlatform(DevicePlatform platform) {
        this.platform = platform.toString();
    }
    /**
     * 
     * The platform of the device (e.g., ANDROID or IOS).
     * 
     * 
     * @param platform
     *        The platform of the device (e.g., ANDROID or IOS).
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     * @see DevicePlatform
     */
    public Offering withPlatform(DevicePlatform platform) {
        setPlatform(platform);
        return this;
    }
    /**
     * 
     * Specifies whether there are recurring charges for the offering.
     * 
     * 
     * @return Specifies whether there are recurring charges for the offering.
     */
    public java.util.List getRecurringCharges() {
        return recurringCharges;
    }
    /**
     * 
     * Specifies whether there are recurring charges for the offering.
     * 
     * 
     * @param recurringCharges
     *        Specifies whether there are recurring charges for the offering.
     */
    public void setRecurringCharges(
            java.util.Collection recurringCharges) {
        if (recurringCharges == null) {
            this.recurringCharges = null;
            return;
        }
        this.recurringCharges = new java.util.ArrayList(
                recurringCharges);
    }
    /**
     * 
     * Specifies whether there are recurring charges for the offering.
     * 
     * 
     * NOTE: This method appends the values to the existing list (if
     * any). Use {@link #setRecurringCharges(java.util.Collection)} or
     * {@link #withRecurringCharges(java.util.Collection)} if you want to
     * override the existing values.
     * 
     * 
     * @param recurringCharges
     *        Specifies whether there are recurring charges for the offering.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Offering withRecurringCharges(RecurringCharge... recurringCharges) {
        if (this.recurringCharges == null) {
            setRecurringCharges(new java.util.ArrayList(
                    recurringCharges.length));
        }
        for (RecurringCharge ele : recurringCharges) {
            this.recurringCharges.add(ele);
        }
        return this;
    }
    /**
     * 
     * Specifies whether there are recurring charges for the offering.
     * 
     * 
     * @param recurringCharges
     *        Specifies whether there are recurring charges for the offering.
     * @return Returns a reference to this object so that method calls can be
     *         chained together.
     */
    public Offering withRecurringCharges(
            java.util.Collection recurringCharges) {
        setRecurringCharges(recurringCharges);
        return this;
    }
    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getId() != null)
            sb.append("Id: " + getId() + ",");
        if (getDescription() != null)
            sb.append("Description: " + getDescription() + ",");
        if (getType() != null)
            sb.append("Type: " + getType() + ",");
        if (getPlatform() != null)
            sb.append("Platform: " + getPlatform() + ",");
        if (getRecurringCharges() != null)
            sb.append("RecurringCharges: " + getRecurringCharges());
        sb.append("}");
        return sb.toString();
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (obj instanceof Offering == false)
            return false;
        Offering other = (Offering) obj;
        if (other.getId() == null ^ this.getId() == null)
            return false;
        if (other.getId() != null
                && other.getId().equals(this.getId()) == false)
            return false;
        if (other.getDescription() == null ^ this.getDescription() == null)
            return false;
        if (other.getDescription() != null
                && other.getDescription().equals(this.getDescription()) == false)
            return false;
        if (other.getType() == null ^ this.getType() == null)
            return false;
        if (other.getType() != null
                && other.getType().equals(this.getType()) == false)
            return false;
        if (other.getPlatform() == null ^ this.getPlatform() == null)
            return false;
        if (other.getPlatform() != null
                && other.getPlatform().equals(this.getPlatform()) == false)
            return false;
        if (other.getRecurringCharges() == null
                ^ this.getRecurringCharges() == null)
            return false;
        if (other.getRecurringCharges() != null
                && other.getRecurringCharges().equals(
                        this.getRecurringCharges()) == false)
            return false;
        return true;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        hashCode = prime * hashCode
                + ((getId() == null) ? 0 : getId().hashCode());
        hashCode = prime
                * hashCode
                + ((getDescription() == null) ? 0 : getDescription().hashCode());
        hashCode = prime * hashCode
                + ((getType() == null) ? 0 : getType().hashCode());
        hashCode = prime * hashCode
                + ((getPlatform() == null) ? 0 : getPlatform().hashCode());
        hashCode = prime
                * hashCode
                + ((getRecurringCharges() == null) ? 0 : getRecurringCharges()
                        .hashCode());
        return hashCode;
    }
    @Override
    public Offering clone() {
        try {
            return (Offering) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                            + "even though we're Cloneable!", e);
        }
    }
}