X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=PolicyEngineAPI%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fapi%2FDeletePolicyCondition.java;h=34b4817197ff40e287a98febf0e8f05ccc1f936a;hb=5450bdbfb94fb5217617da6c41971fd26f7e81b5;hp=117ac716eb24f0d8b34da963577b826d28dce9b4;hpb=a9710cb3b80c73c98d257c676ba6ecf9e30ef758;p=policy%2Fengine.git diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/api/DeletePolicyCondition.java b/PolicyEngineAPI/src/main/java/org/onap/policy/api/DeletePolicyCondition.java index 117ac716e..34b481719 100644 --- a/PolicyEngineAPI/src/main/java/org/onap/policy/api/DeletePolicyCondition.java +++ b/PolicyEngineAPI/src/main/java/org/onap/policy/api/DeletePolicyCondition.java @@ -29,38 +29,41 @@ import com.fasterxml.jackson.annotation.JsonCreator; * @version 0.1 */ public enum DeletePolicyCondition { - - /** - * Indicates a condition to only delete the current version of the policy. - */ - ONE("Current Version"), - - /** - * Indicates a condition to delete all versions of the policy. - */ - ALL("All Versions"); - private String name; - private DeletePolicyCondition(String name){ - this.name = name; - } + /** + * Indicates a condition to only delete the current version of the policy. + */ + ONE("Current Version"), - /** - * Returns the String format of delete condition for this Policy - * @return the String of the delete condition for this Policy - */ - @Override - public String toString(){ - return this.name; - } + /** + * Indicates a condition to delete all versions of the policy. + */ + ALL("All Versions"); - @JsonCreator - public static DeletePolicyCondition create (String value) { - for(DeletePolicyCondition type: values()){ - if(type.toString().equals(value) || type.equals(DeletePolicyCondition.valueOf(value))){ + private final String name; + + private DeletePolicyCondition(final String name) { + this.name = name; + } + + /** + * Returns the String format of delete condition for this + * Policy + * + * @return the String of the delete condition for this Policy + */ + @Override + public String toString() { + return this.name; + } + + @JsonCreator + public static DeletePolicyCondition create(final String value) { + for (final DeletePolicyCondition type : values()) { + if (type.toString().equalsIgnoreCase(value) || type.name().equalsIgnoreCase(value)) { return type; } } - throw new IllegalArgumentException(); + throw new IllegalArgumentException("Invalid value: " + value); } }