com.arm.mbed.cloud.sdk.devices.model.DeviceEnrollmentDenial 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.devices.model;
import com.arm.mbed.cloud.sdk.annotations.Internal;
import com.arm.mbed.cloud.sdk.annotations.Preamble;
import com.arm.mbed.cloud.sdk.common.SdkModel;
import java.util.Date;
/**
* Model for a device enrollment denial.
*/
@Preamble(description = "Model for a device enrollment denial.")
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
public class DeviceEnrollmentDenial implements SdkModel {
/**
* Serialisation Id.
*/
private static final long serialVersionUID = 3114354744522935L;
/**
* account id.
*/
private final String accountId;
/**
* date on which the failed bootstrap was attempted on.
*/
private final Date createdAt;
/**
* endpoint name.
*/
private final String endpointName;
/**
* id of the recorded failed bootstrap attempt.
*/
private String id;
/**
* Trusted certificate id.
*/
private final String trustedCertificateId;
/**
* Internal constructor.
*
*
* Constructor based on all fields.
*
* Note: Should not be used. Use {@link #DeviceEnrollmentDenial()} instead.
*
* @param accountId
* account id.
* @param createdAt
* date on which the failed bootstrap was attempted on.
* @param endpointName
* endpoint name.
* @param id
* id of the recorded failed bootstrap attempt.
* @param trustedCertificateId
* Trusted certificate id.
*/
@Internal
public DeviceEnrollmentDenial(String accountId, Date createdAt, String endpointName, String id,
String trustedCertificateId) {
super();
this.accountId = accountId;
this.createdAt = createdAt;
this.endpointName = endpointName;
this.trustedCertificateId = trustedCertificateId;
setId(id);
}
/**
* Internal constructor.
*
*
* Constructor based on a similar object.
*
* Note: Should not be used. Use {@link #DeviceEnrollmentDenial()} instead.
*
* @param deviceEnrollmentDenial
* a device enrollment denial.
*/
@Internal
public DeviceEnrollmentDenial(DeviceEnrollmentDenial deviceEnrollmentDenial) {
this(deviceEnrollmentDenial == null ? (String) null : deviceEnrollmentDenial.accountId,
deviceEnrollmentDenial == null ? new Date() : deviceEnrollmentDenial.createdAt,
deviceEnrollmentDenial == null ? (String) null : deviceEnrollmentDenial.endpointName,
deviceEnrollmentDenial == null ? (String) null : deviceEnrollmentDenial.id,
deviceEnrollmentDenial == null ? (String) null : deviceEnrollmentDenial.trustedCertificateId);
}
/**
* Constructor.
*/
public DeviceEnrollmentDenial() {
this((String) null, new Date(), (String) null, (String) null, (String) null);
}
/**
* Constructor.
*
*
* Constructor based on object identifier.
*
*
* @param id
* id of the recorded failed bootstrap attempt.
*/
public DeviceEnrollmentDenial(String id) {
this();
setId(id);
}
/**
* Internal constructor.
*
*
* Constructor based on read-only fields.
*
* Note: Should not be used. Use {@link #DeviceEnrollmentDenial()} instead.
*
* @param accountId
* account id.
* @param createdAt
* date on which the failed bootstrap was attempted on.
* @param endpointName
* endpoint name.
* @param trustedCertificateId
* Trusted certificate id.
*/
@Internal
public DeviceEnrollmentDenial(String accountId, Date createdAt, String endpointName, String trustedCertificateId) {
this(accountId, createdAt, endpointName, (String) null, trustedCertificateId);
}
/**
* Gets account id.
*
* @return accountId
*/
public String getAccountId() {
return accountId;
}
/**
* Gets date on which the failed bootstrap was attempted on.
*
* @return createdAt
*/
public Date getCreatedAt() {
return createdAt;
}
/**
* Gets endpoint name.
*
* @return endpointName
*/
public String getEndpointName() {
return endpointName;
}
/**
* Gets id of the recorded failed bootstrap attempt.
*
* @return id
*/
@Override
public String getId() {
return id;
}
/**
* Sets id of the recorded failed bootstrap attempt.
*
*
* Note: the length of the string has to match {@code /[a-f0-9]{32}/} to be valid
*
* @param id
* id of the recorded failed bootstrap attempt.
*/
@Override
public void setId(String id) {
this.id = id;
}
/**
* Sets id of the recorded failed bootstrap attempt.
*
*
* Similar to {@link #setId(String)}
*
* Note: the length of the string has to match {@code /[a-f0-9]{32}/} to be valid
*
* @param deviceEnrollmentDenialId
* id of the recorded failed bootstrap attempt.
*/
@Internal
public void setDeviceEnrollmentDenialId(String deviceEnrollmentDenialId) {
setId(deviceEnrollmentDenialId);
}
/**
* Checks whether id value is valid.
*
* @return true if the value is valid; false otherwise.
*/
@SuppressWarnings("PMD.UselessParentheses")
public boolean isIdValid() {
return (id == null || id.matches("[a-f0-9]{32}"));
}
/**
* Gets trusted certificate id.
*
* @return trustedCertificateId
*/
public String getTrustedCertificateId() {
return trustedCertificateId;
}
/**
* Returns a string representation of the object.
*
*
*
* @see java.lang.Object#toString()
* @return the string representation
*/
@Override
public String toString() {
return "DeviceEnrollmentDenial [accountId=" + accountId + ", createdAt=" + createdAt + ", endpointName="
+ endpointName + ", id=" + id + ", trustedCertificateId=" + trustedCertificateId + "]";
}
/**
* 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 + ((accountId == null) ? 0 : accountId.hashCode());
result = prime * result + ((createdAt == null) ? 0 : createdAt.hashCode());
result = prime * result + ((endpointName == null) ? 0 : endpointName.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((trustedCertificateId == null) ? 0 : trustedCertificateId.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 DeviceEnrollmentDenial;
}
/**
* 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 DeviceEnrollmentDenial)) {
return false;
}
final DeviceEnrollmentDenial other = (DeviceEnrollmentDenial) obj;
if (!other.canEqual(this)) {
return false;
}
if (accountId == null) {
if (other.accountId != null) {
return false;
}
} else if (!accountId.equals(other.accountId)) {
return false;
}
if (createdAt == null) {
if (other.createdAt != null) {
return false;
}
} else if (!createdAt.equals(other.createdAt)) {
return false;
}
if (endpointName == null) {
if (other.endpointName != null) {
return false;
}
} else if (!endpointName.equals(other.endpointName)) {
return false;
}
if (id == null) {
if (other.id != null) {
return false;
}
} else if (!id.equals(other.id)) {
return false;
}
if (trustedCertificateId == null) {
if (other.trustedCertificateId != null) {
return false;
}
} else if (!trustedCertificateId.equals(other.trustedCertificateId)) {
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 isIdValid();
}
/**
* Clones this instance.
*
*
*
* @see java.lang.Object#clone()
* @return a cloned instance
*/
@Override
public DeviceEnrollmentDenial clone() {
return new DeviceEnrollmentDenial(this);
}
}