com.arm.mbed.cloud.sdk.security.model.VerificationResponse Maven / Gradle / Ivy
Show all versions of mbed-cloud-sdk Show documentation
// This file was generated by the Pelion SDK foundation code generator.
// This is an autogenerated model class. Do not modify its content as modifications will be lost at next code generation.
package com.arm.mbed.cloud.sdk.security.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;
/**
* Model for certificate issuer verification response.
*/
@Preamble(description = "Model for certificate issuer verification response.")
public class VerificationResponse implements SdkModel {
/**
* Serialisation Id.
*/
private static final long serialVersionUID = 5697863938758676447L;
private final boolean isSuccessful;
private String message;
/**
* Internal constructor.
*
* Note: Should not be used. Use {@link #VerificationResponse()} instead.
*
* @param isSuccessful
* States whether the verification was successful.
* @param message
* message providing details in case of verification failure.
*
*/
@Internal
public VerificationResponse(boolean isSuccessful, String message) {
super();
this.isSuccessful = isSuccessful;
this.message = message;
}
/**
* Internal constructor.
*
* Note: Should not be used. Use {@link #VerificationResponse()} instead.
*
* @param response
* a verification response.
*/
@Internal
public VerificationResponse(VerificationResponse response) {
this(response == null ? false : response.isSuccessful, response == null ? null : response.message);
}
/**
* Constructor.
*/
public VerificationResponse() {
this(false, null);
}
/**
* Constructor.
*
* @param id
* The ID of the certificate issuer verification response.
*/
public VerificationResponse(String id) {
this();
setId(id);
}
/**
* Gets the id of the certificate issuer verification response.
*
* @return id
*/
@Override
public String getId() {
return message;
}
/**
* Sets the id of the certificate issuer verification response.
*
* @param id
* The ID of the certificate issuer verification response.
*/
public void setId(String id) {
this.message = id;
}
/**
* States whether the verification was successful or not.
*
* @return true if verification was successful. False otherwise.
*/
public boolean isSuccessful() {
return isSuccessful;
}
/**
* Provides details in case of verification failure.
*
* @return the message.
*/
public String getMessage() {
return message;
}
/**
* 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 + (isSuccessful ? 1231 : 1237);
result = prime * result + ((message == null) ? 0 : message.hashCode());
return result;
}
/**
* 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 (!getClass().isAssignableFrom(obj.getClass())) {
return false;
}
final VerificationResponse other = (VerificationResponse) obj;
if (message == null) {
if (other.message != null) {
return false;
}
} else if (!message.equals(other.message)) {
return false;
}
return isSuccessful == other.isSuccessful;
}
/**
* Returns a string representation of the object.
*
*
* @see java.lang.Object#toString()
* @return the string representation
*/
@Override
public String toString() {
return "Verification response [isSuccessful=" + isSuccessful + ", message=" + message + "]";
}
/**
* 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 true;
}
/**
* Clones this instance.
*
*
* @see java.lang.Object#clone()
* @return something
*/
@Override
public VerificationResponse clone() {
return new VerificationResponse(this);
}
}