X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=PolicyEngineAPI%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fapi%2FPolicyDecision.java;h=782d4445984744105895b238742474160a1a04b2;hb=5450bdbfb94fb5217617da6c41971fd26f7e81b5;hp=6bae84cc72e08fcc654945c23b3badb45dc91477;hpb=a9710cb3b80c73c98d257c676ba6ecf9e30ef758;p=policy%2Fengine.git diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyDecision.java b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyDecision.java index 6bae84cc7..782d44459 100644 --- a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyDecision.java +++ b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyDecision.java @@ -23,47 +23,48 @@ package org.onap.policy.api; import com.fasterxml.jackson.annotation.JsonCreator; /** - * Enumeration of PolicyDecision that can be returned as a part of + * Enumeration of PolicyDecision that can be returned as a part of * {@link org.onap.policy.api.DecisionResponse} getDecision(). * * @version 0.1 */ public enum PolicyDecision { - /** - * Indicates that the Decision is to Permit. - */ - PERMIT("permit"), - /** - * Indicates that the Decision is to Deny. - */ - DENY("deny"), - /** - * Indicates that the Decision process has some issues. - */ - ERROR("error") - ; - - private String name; - private PolicyDecision(String name){ - this.name = name; - } - - /** - * Returns the String name for this PolicyDecision - * - * @return the String name for this PolicyDecision - */ - @Override - public String toString(){ - return this.name; - } - @JsonCreator - public static PolicyDecision create (String value) { - for(PolicyDecision type: values()){ - if(type.toString().equals(value) || type.equals(PolicyDecision.valueOf(value))){ + /** + * Indicates that the Decision is to Permit. + */ + PERMIT("permit"), + /** + * Indicates that the Decision is to Deny. + */ + DENY("deny"), + /** + * Indicates that the Decision process has some issues. + */ + ERROR("error"); + + private final String name; + + private PolicyDecision(final String name) { + this.name = name; + } + + /** + * Returns the String name for this PolicyDecision + * + * @return the String name for this PolicyDecision + */ + @Override + public String toString() { + return this.name; + } + + @JsonCreator + public static PolicyDecision create(final String value) { + for (final PolicyDecision type : values()) { + if (type.toString().equalsIgnoreCase(value) || type.name().equalsIgnoreCase(value)) { return type; } } - throw new IllegalArgumentException(); + throw new IllegalArgumentException("Invalid value: " + value); } }