com.arm.mbed.cloud.sdk.security.model.CertificateEnrollmentEnrollResult 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.DefaultValue;
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.SdkEnum;
/**
* Certificate enrollment enroll result.
*/
@Preamble(description = "Certificate enrollment enroll result.")
public enum CertificateEnrollmentEnrollResult implements SdkEnum {
FAILURE("failure"),
FORBIDDEN("forbidden"),
NOT_FOUND("not_found"),
SUCCESS("success"),
UNKNOWN_ENUM(SDK_UNKNOWN_ENUM_VALUE);
/**
* Serialisation Id.
*/
private static final long serialVersionUID = 1533033948351820L;
/**
* string representation.
*/
@Internal
@Required
@DefaultValue("FAILURE")
private final String string;
/**
* Internal constructor.
*
* @param string
* string representation.
*/
@Internal
CertificateEnrollmentEnrollResult(@DefaultValue("FAILURE") String string) {
this.string = string;
}
/**
* Gets string representation.
*
* @return string
*/
@Override
public String getString() {
return string;
}
/**
* toString.
*
*
* @see java.lang.Enum#toString()
* @return the string representation of this value
*/
@Override
public String toString() {
return getString();
}
/**
* States whether it is the default value.
*
*
* @see SdkEnum#isDefault()
* @return true if this is the default value; false otherwise
*/
@Override
public boolean isDefault() {
return this == getDefault();
}
/**
* States whether the value is unknown and an error happened during parsing.
*
*
* @see SdkEnum#isUnknownValue()
* @return true if this is an unknown value; false otherwise
*/
@Override
public boolean isUnknownValue() {
return this == getUnknownEnum();
}
/**
* Gets default certificate enrollment enroll result.
*
* @return default certificate enrollment enroll result
*/
public static CertificateEnrollmentEnrollResult getDefault() {
return FAILURE;
}
/**
* Gets unknown certificate enrollment enroll result value.
*
* @return unknown certificate enrollment enroll result
*/
public static CertificateEnrollmentEnrollResult getUnknownEnum() {
return UNKNOWN_ENUM;
}
/**
* Gets certificate enrollment enroll result from its string representation.
*
* @param value
* string.
* @return corresponding certificate enrollment enroll result or default certificate enrollment enroll result if not
* recognised.
*/
public static CertificateEnrollmentEnrollResult getState(String value) {
if (value == null) {
return getDefault();
}
final String trimmedValue = value.trim();
for (final CertificateEnrollmentEnrollResult option : values()) {
if (option.getString().equalsIgnoreCase(trimmedValue)) {
return option;
}
}
return getDefault();
}
/**
* Merges two states.
*
*
* @see SdkEnum#merge(SdkEnum, SdkEnum)
* @param obj1
* a certificate enrollment enroll result.
* @param obj2
* a certificate enrollment enroll result.
* @return the merged enumerator
*/
@Override
public T merge(T obj1, T obj2) {
if (obj1 == null) {
return obj2;
}
if (obj2 == null) {
return obj1;
}
if (obj1.isDefault()) {
return obj2;
}
if (obj2.isDefault()) {
return obj1;
}
return obj2;
}
}