summaryrefslogtreecommitdiffstats
path: root/common-be
diff options
context:
space:
mode:
Diffstat (limited to 'common-be')
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaGetFunctionType.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaGetFunctionType.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaGetFunctionType.java
index d84c86a38d..c1895f3f80 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaGetFunctionType.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaGetFunctionType.java
@@ -19,6 +19,8 @@
package org.openecomp.sdc.be.datatypes.tosca;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Optional;
import lombok.AllArgsConstructor;
import lombok.Getter;
@@ -34,6 +36,16 @@ public enum ToscaGetFunctionType {
private final String functionName;
private final String propertyType;
+ private static final Map<String, ToscaGetFunctionType> BY_FUNCTION_NAME = new HashMap<>();
+ private static final Map<String, ToscaGetFunctionType> BY_PROPERTY_TYPE = new HashMap<>();
+
+ static {
+ for (ToscaGetFunctionType e : values()) {
+ BY_FUNCTION_NAME.put(e.functionName, e);
+ BY_PROPERTY_TYPE.put(e.propertyType, e);
+ }
+ }
+
/**
* Converts a {@link ToscaFunctionType} to a {@link ToscaGetFunctionType}
* @param toscaFunctionType the tosca function type to convert
@@ -52,4 +64,12 @@ public enum ToscaGetFunctionType {
}
}
+ public static ToscaGetFunctionType valueOfFunctionName(String functionName) {
+ return BY_FUNCTION_NAME.get(functionName);
+ }
+
+ public static ToscaGetFunctionType valueOfPropertyType(String propertyType) {
+ return BY_PROPERTY_TYPE.get(propertyType);
+ }
+
}