X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=PolicyEngineAPI%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fapi%2FPolicyClass.java;h=fb389bb0314bddffc13ba46cba309ea30a911b16;hb=5450bdbfb94fb5217617da6c41971fd26f7e81b5;hp=6a648e8e6ade620ecf66d5fbb3503562866f07da;hpb=a9710cb3b80c73c98d257c676ba6ecf9e30ef758;p=policy%2Fengine.git diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyClass.java b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyClass.java index 6a648e8e6..fb389bb03 100644 --- a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyClass.java +++ b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyClass.java @@ -29,40 +29,44 @@ import com.fasterxml.jackson.annotation.JsonCreator; * @version 0.1 */ public enum PolicyClass { - /** - * Indicates Config based Policy. - */ - Config("Config"), - /** - * Indicates Action based Policy. - */ - Action("Action"), - /** - * Indicates Decision based Policy. - */ - Decision("Decision") - ; - private String name; - - private PolicyClass(String typeName){ - this.name = typeName; - } - - /** - * Returns the String format of Type for this PolicyClass - * @return the String of the Type for this PolicyClass - */ - @Override - public String toString() { - return this.name; - } - @JsonCreator - public static PolicyClass create (String value) { - for(PolicyClass type: values()){ - if(type.toString().equals(value) || type.equals(PolicyClass.valueOf(value))){ + /** + * Indicates Config based Policy. + */ + Config("Config"), + /** + * Indicates Action based Policy. + */ + Action("Action"), + /** + * Indicates Decision based Policy. + */ + Decision("Decision"); + + private final String name; + + private PolicyClass(final String typeName) { + this.name = typeName; + } + + /** + * Returns the String format of Type for this + * PolicyClass + * + * @return the String of the Type for this + * PolicyClass + */ + @Override + public String toString() { + return this.name; + } + + @JsonCreator + public static PolicyClass create(final String value) { + for (final PolicyClass type : values()) { + if (type.toString().equalsIgnoreCase(value) || type.name().equalsIgnoreCase(value)) { return type; } } - throw new IllegalArgumentException(); + throw new IllegalArgumentException("Invalid value: " + value); } }