From e0addf5b588a1244f9679becd90999dfcb4c3a94 Mon Sep 17 00:00:00 2001 From: "ITSERVICES\\rb7147" Date: Tue, 25 Apr 2017 11:46:00 -0400 Subject: Policy 1707 commit to LF Change-Id: Ibe6f01d92f9a434c040abb05d5386e89d675ae65 Signed-off-by: ITSERVICES\rb7147 --- .../org/openecomp/policy/api/PolicyConfigType.java | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyConfigType.java') 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 String of the Type for this PolicyClass */ 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(); + } } -- cgit 1.2.3-korg