aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PropertyType.java35
1 files changed, 24 insertions, 11 deletions
diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PropertyType.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PropertyType.java
index bebf6d34bf..02c4b7fde4 100644
--- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PropertyType.java
+++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PropertyType.java
@@ -1,28 +1,26 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2018 European Support Limited
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.sdc.tosca.datatypes.model;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
+import java.util.Set;
public enum PropertyType {
@@ -39,6 +37,8 @@ public enum PropertyType {
private static final Map<String, PropertyType> mMap =
Collections.unmodifiableMap(initializeMapping());
+ private static final Set<String> simplePropertyTypes =
+ Collections.unmodifiableSet(initializeSimplePropertyTypes());
private String displayName;
PropertyType(String displayName) {
@@ -51,7 +51,7 @@ public enum PropertyType {
* @return Map
*/
public static Map<String, PropertyType> initializeMapping() {
- Map<String, PropertyType> typeMap = new HashMap<String, PropertyType>();
+ Map<String, PropertyType> typeMap = new HashMap<>();
for (PropertyType v : PropertyType.values()) {
typeMap.put(v.displayName, v);
}
@@ -60,7 +60,7 @@ public enum PropertyType {
/**
* Get Property type by display name.
- * @param displayName.
+ * @param displayName
* @return PropertyType
*/
public static PropertyType getPropertyTypeByDisplayName(String displayName) {
@@ -73,6 +73,19 @@ public enum PropertyType {
return null;
}
+ private static Set<String> initializeSimplePropertyTypes() {
+ Set<String> simplePropertyTypes = new HashSet<>(4);
+ simplePropertyTypes.add(STRING.getDisplayName().toLowerCase());
+ simplePropertyTypes.add(INTEGER.getDisplayName().toLowerCase());
+ simplePropertyTypes.add(FLOAT.getDisplayName().toLowerCase());
+ simplePropertyTypes.add(BOOLEAN.getDisplayName().toLowerCase());
+ return simplePropertyTypes;
+ }
+
+ public static Set<String> getSimplePropertyTypes() {
+ return simplePropertyTypes;
+ }
+
public String getDisplayName() {
return displayName;
}