diff options
Diffstat (limited to 'PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigType.java')
-rw-r--r-- | PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigType.java | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigType.java b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigType.java index 111c85623..7b3ca2f23 100644 --- a/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigType.java +++ b/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigType.java @@ -20,13 +20,15 @@ package org.openecomp.policy.api; +import com.fasterxml.jackson.annotation.JsonCreator; + /** * Enumeration of the Policy Config Types that is used as a part of * {@link org.openecomp.policy.api.PolicyParameters}. * * @version 0.1 */ -public enum PolicyConfigType { +public enum PolicyConfigType{ /** * Indicates Base Config Policy. */ @@ -59,8 +61,8 @@ public enum PolicyConfigType { private String name; - private PolicyConfigType(String typeName){ - this.name = typeName; + private PolicyConfigType(String name){ + this.name = name; } /** @@ -68,6 +70,16 @@ public enum PolicyConfigType { * @return the <code>String</code> of the Type for this <code>PolicyClass</code> */ public String toString() { - return this.name; + return name; } + + @JsonCreator + public static PolicyConfigType create (String value) { + for(PolicyConfigType type: values()){ + if(type.toString().equals(value) || type.equals(PolicyConfigType.valueOf(value))){ + return type; + } + } + throw new IllegalArgumentException(); + } } |