X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=PolicyEngineAPI%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fapi%2FPolicyType.java;h=0ff5480bfdad691f4ee36476fd3d34873cd1626f;hb=5450bdbfb94fb5217617da6c41971fd26f7e81b5;hp=a29a6c44090b0a3b7653ff074cb05473c8e0abf2;hpb=a9710cb3b80c73c98d257c676ba6ecf9e30ef758;p=policy%2Fengine.git
diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyType.java b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyType.java
index a29a6c440..0ff5480bf 100644
--- a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyType.java
+++ b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyType.java
@@ -29,45 +29,48 @@ import com.fasterxml.jackson.annotation.JsonCreator;
* @version 0.2
*/
public enum PolicyType {
- /**
- * Indicates the response is Properties type
- */
- PROPERTIES("Properties"),
- /**
- * Indicates the response is JSON type
- */
- JSON("json"),
- /**
- * Indicates the response is XML type
- */
- XML("xml"),
- /**
- * Indicates the response is Other type
- */
- OTHER("other")
- ;
-
- private String name;
-
- private PolicyType(String typeName) {
- this.name = typeName;
- }
-
- /**
- * Returns the String
format of Type for this PolicyType
- * @return the String
of the Type for this PolicyType
- */
- @Override
- public String toString() {
- return this.name;
- }
- @JsonCreator
- public static PolicyType create (String value) {
- for(PolicyType type: values()){
- if(type.toString().equalsIgnoreCase(value)){
+ /**
+ * Indicates the response is Properties type
+ */
+ PROPERTIES("Properties"),
+ /**
+ * Indicates the response is JSON type
+ */
+ JSON("json"),
+ /**
+ * Indicates the response is XML type
+ */
+ XML("xml"),
+ /**
+ * Indicates the response is Other type
+ */
+ OTHER("other");
+
+ private final String name;
+
+ private PolicyType(final String typeName) {
+ this.name = typeName;
+ }
+
+ /**
+ * Returns the String
format of Type for this
+ * PolicyType
+ *
+ * @return the String
of the Type for this
+ * PolicyType
+ */
+ @Override
+ public String toString() {
+ return this.name;
+ }
+
+ @JsonCreator
+ public static PolicyType create(final String value) {
+ for (final PolicyType type : values()) {
+ if (type.toString().equalsIgnoreCase(value) || type.name().equalsIgnoreCase(value)) {
return type;
}
}
- throw new IllegalArgumentException();
- }
+ throw new IllegalArgumentException("Invalid value: " + value);
+ }
}