2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.tosca.datatypes.model;
23 import java.util.Collections;
24 import java.util.HashMap;
28 * The enum Property type.
30 public enum PropertyType {
33 * String property type.
37 * Integer property type.
41 * Float property type.
45 * Boolean property type.
49 * Timestamp property type.
51 TIMESTAMP("timestamp"),
65 * Scalar unit size property type.
67 SCALAR_UNIT_SIZE("scalar-unit.size");
69 private static final Map<String, PropertyType> mMap =
70 Collections.unmodifiableMap(initializeMapping());
71 private String displayName;
73 PropertyType(String displayName) {
75 this.displayName = displayName;
79 * Initialize mapping map.
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);
92 * Gets property type by display name.
94 * @param displayName the display name
95 * @return the property type by display name
97 public static PropertyType getPropertyTypeByDisplayName(String displayName) {
101 if (mMap.containsKey(displayName)) {
102 return mMap.get(displayName);
110 * @return the display name
112 public String getDisplayName() {