[sdc] docker file fix for cassandra
[sdc.git] / openecomp-be / lib / openecomp-tosca-lib / src / main / java / org / openecomp / sdc / tosca / datatypes / model / PropertyType.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.tosca.datatypes.model;
22
23 import java.util.Collections;
24 import java.util.HashMap;
25 import java.util.Map;
26
27 /**
28  * The enum Property type.
29  */
30 public enum PropertyType {
31
32   /**
33    * String property type.
34    */
35   STRING("string"),
36   /**
37    * Integer property type.
38    */
39   INTEGER("integer"),
40   /**
41    * Float property type.
42    */
43   FLOAT("float"),
44   /**
45    * Boolean property type.
46    */
47   BOOLEAN("boolean"),
48   /**
49    * Timestamp property type.
50    */
51   TIMESTAMP("timestamp"),
52   /**
53    * Null property type.
54    */
55   NULL("null"),
56   /**
57    * Map property type.
58    */
59   MAP("map"),
60   /**
61    * List property type.
62    */
63   LIST("list"),
64   /**
65    * Scalar unit size property type.
66    */
67   SCALAR_UNIT_SIZE("scalar-unit.size");
68
69   private static final Map<String, PropertyType> mMap =
70       Collections.unmodifiableMap(initializeMapping());
71   private String displayName;
72
73   PropertyType(String displayName) {
74
75     this.displayName = displayName;
76   }
77
78   /**
79    * Initialize mapping map.
80    *
81    * @return the map
82    */
83   public static Map<String, PropertyType> initializeMapping() {
84     Map<String, PropertyType> typeMap = new HashMap<String, PropertyType>();
85     for (PropertyType v : PropertyType.values()) {
86       typeMap.put(v.displayName, v);
87     }
88     return typeMap;
89   }
90
91   /**
92    * Gets property type by display name.
93    *
94    * @param displayName the display name
95    * @return the property type by display name
96    */
97   public static PropertyType getPropertyTypeByDisplayName(String displayName) {
98     if (mMap == null) {
99       initializeMapping();
100     }
101     if (mMap.containsKey(displayName)) {
102       return mMap.get(displayName);
103     }
104     return null;
105   }
106
107   /**
108    * Gets display name.
109    *
110    * @return the display name
111    */
112   public String getDisplayName() {
113     return displayName;
114   }
115
116
117 }