com.arm.mbed.cloud.sdk.deviceupdate.model.CampaignStatistics Maven / Gradle / Ivy
Show all versions of foundation-models Show documentation
// This file was generated by the Pelion SDK foundation code generator.
// This is an autogenerated class. Do not modify its content as modifications will be lost at next code generation.
package com.arm.mbed.cloud.sdk.deviceupdate.model;
import com.arm.mbed.cloud.sdk.annotations.Internal;
import com.arm.mbed.cloud.sdk.annotations.Preamble;
import com.arm.mbed.cloud.sdk.annotations.Required;
import com.arm.mbed.cloud.sdk.common.SdkModel;
import com.arm.mbed.cloud.sdk.common.TranslationUtils;
import java.util.Date;
import java.util.Objects;
/**
* Model for a campaign statistics.
*/
@Preamble(description = "Model for a campaign statistics.")
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
public class CampaignStatistics implements SdkModel {
/**
* Serialisation Id.
*/
private static final long serialVersionUID = 3517266743113161L;
/**
* ID of the associated campaign.
*/
@Required
private String campaignId;
/**
* value.
*/
private final int count;
/**
* value.
*/
private final Date createdAt;
/**
* ID of the event type description.
*/
private CampaignStatisticsId id;
/**
* The event type description.
*/
private final CampaignStatisticsSummaryStatus summaryStatus;
/**
* Internal constructor.
*
*
* Constructor based on all fields.
*
* Note: Should not be used. Use {@link #CampaignStatistics()} instead.
*
* @param campaignId
* ID of the associated campaign.
* @param count
* value.
* @param createdAt
* value.
* @param id
* ID of the event type description.
* @param summaryStatus
* The event type description.
*/
@Internal
public CampaignStatistics(String campaignId, int count, Date createdAt, CampaignStatisticsId id,
CampaignStatisticsSummaryStatus summaryStatus) {
super();
this.count = count;
this.createdAt = createdAt;
this.summaryStatus = summaryStatus;
setCampaignId(campaignId);
setId(id);
}
/**
* Internal constructor.
*
*
* Constructor based on a similar object.
*
* Note: Should not be used. Use {@link #CampaignStatistics()} instead.
*
* @param campaignStatistics
* a campaign statistics.
*/
@Internal
public CampaignStatistics(CampaignStatistics campaignStatistics) {
this(campaignStatistics == null ? (String) null : campaignStatistics.campaignId,
campaignStatistics == null ? 0 : campaignStatistics.count,
campaignStatistics == null ? new Date() : campaignStatistics.createdAt,
campaignStatistics == null ? CampaignStatisticsId.getDefault() : campaignStatistics.id,
campaignStatistics == null ? CampaignStatisticsSummaryStatus.getDefault()
: campaignStatistics.summaryStatus);
}
/**
* Constructor.
*/
public CampaignStatistics() {
this((String) null, 0, new Date(), CampaignStatisticsId.getDefault(),
CampaignStatisticsSummaryStatus.getDefault());
}
/**
* Constructor.
*
*
* Constructor based on object identifier.
*
*
* @param id
* ID of the event type description.
*/
public CampaignStatistics(CampaignStatisticsId id) {
this();
setId(id);
}
/**
* Internal constructor.
*
*
* Constructor based on read-only fields.
*
* Note: Should not be used. Use {@link #CampaignStatistics()} instead.
*
* @param count
* value.
* @param createdAt
* value.
* @param summaryStatus
* The event type description.
*/
@Internal
public CampaignStatistics(int count, Date createdAt, CampaignStatisticsSummaryStatus summaryStatus) {
this((String) null, count, createdAt, CampaignStatisticsId.getDefault(), summaryStatus);
}
/**
* Constructor.
*
*
* Constructor based on required fields.
*
*
* @param campaignId
* ID of the associated campaign.
*/
public CampaignStatistics(String campaignId) {
this(campaignId, 0, new Date(), CampaignStatisticsId.getDefault(),
CampaignStatisticsSummaryStatus.getDefault());
}
/**
* Gets id of the associated campaign.
*
* @return campaignId
*/
public String getCampaignId() {
return campaignId;
}
/**
* Sets id of the associated campaign.
*
* @param campaignId
* ID of the associated campaign.
*/
@Required
public void setCampaignId(String campaignId) {
this.campaignId = campaignId;
}
/**
* Checks whether campaignId value is valid.
*
* @return true if the value is valid; false otherwise.
*/
@SuppressWarnings("PMD.UselessParentheses")
public boolean isCampaignIdValid() {
return campaignId != null;
}
/**
* Gets value.
*
* @return count
*/
public int getCount() {
return count;
}
/**
* Gets value.
*
* @return createdAt
*/
public Date getCreatedAt() {
return createdAt;
}
/**
* Gets id of the event type description.
*
* @return id
*/
@Override
public String getId() {
return TranslationUtils.toString(id);
}
/**
* Sets id of the event type description.
*
* @param id
* ID of the event type description.
*/
public void setId(CampaignStatisticsId id) {
this.id = id;
}
/**
* Sets id of the event type description.
*
*
* Similar to {@link #setId(com.arm.mbed.cloud.sdk.deviceupdate.model.CampaignStatisticsId)}
*
* @param id
* ID of the event type description.
*/
@Override
@Internal
public void setId(String id) {
this.id = CampaignStatisticsId.getValue(id);
}
/**
* Sets id of the event type description.
*
*
* Similar to {@link #setId(String)}
*
* @param campaignStatisticsId
* ID of the event type description.
*/
@Internal
public void setCampaignStatisticsId(String campaignStatisticsId) {
setId(campaignStatisticsId);
}
/**
* Sets id of the event type description.
*
*
* Similar to {@link #setId(com.arm.mbed.cloud.sdk.deviceupdate.model.CampaignStatisticsId)}
*
* @param campaignStatisticsId
* ID of the event type description.
*/
@Internal
public void setCampaignStatisticsId(CampaignStatisticsId campaignStatisticsId) {
setId(campaignStatisticsId);
}
/**
* Gets the event type description.
*
* @return summaryStatus
*/
public CampaignStatisticsSummaryStatus getSummaryStatus() {
return summaryStatus;
}
/**
* Returns a string representation of the object.
*
*
*
* @see java.lang.Object#toString()
* @return the string representation
*/
@Override
public String toString() {
return "CampaignStatistics [campaignId=" + campaignId + ", count=" + count + ", createdAt=" + createdAt
+ ", id=" + id + ", summaryStatus=" + summaryStatus + "]";
}
/**
* Calculates the hash code of this instance based on field values.
*
*
*
* @see java.lang.Object#hashCode()
* @return hash code
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((campaignId == null) ? 0 : campaignId.hashCode());
result = prime * result + Objects.hashCode(Integer.valueOf(count));
result = prime * result + ((createdAt == null) ? 0 : createdAt.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((summaryStatus == null) ? 0 : summaryStatus.hashCode());
return result;
}
/**
* Method to ensure {@link #equals(Object)} is correct.
*
*
* Note: see this article: canEqual()
*
* @param other
* another object.
* @return true if the other object is an instance of the class in which canEqual is (re)defined, false otherwise.
*/
protected boolean canEqual(Object other) {
return other instanceof CampaignStatistics;
}
/**
* Indicates whether some other object is "equal to" this one.
*
*
*
* @see java.lang.Object#equals(java.lang.Object)
* @param obj
* an object to compare with this instance.
* @return true if this object is the same as the obj argument; false otherwise.
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CampaignStatistics)) {
return false;
}
final CampaignStatistics other = (CampaignStatistics) obj;
if (!other.canEqual(this)) {
return false;
}
if (campaignId == null) {
if (other.campaignId != null) {
return false;
}
} else if (!campaignId.equals(other.campaignId)) {
return false;
}
if (count != other.count) {
return false;
}
if (createdAt == null) {
if (other.createdAt != null) {
return false;
}
} else if (!createdAt.equals(other.createdAt)) {
return false;
}
if (id != other.id) {
return false;
}
if (summaryStatus != other.summaryStatus) {
return false;
}
return true;
}
/**
* Checks whether the model is valid or not.
*
*
*
* @see SdkModel#isValid()
* @return true if the model is valid; false otherwise.
*/
@Override
public boolean isValid() {
return isCampaignIdValid();
}
/**
* Clones this instance.
*
*
*
* @see java.lang.Object#clone()
* @return a cloned instance
*/
@Override
public CampaignStatistics clone() {
return new CampaignStatistics(this);
}
}