blob: 9209e6ca01d912e438f758457dec36561df40589 [file] [log] [blame]
Carsten Ziegeler55c96d32012-06-13 12:03:35 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.apache.felix.scrplugin.description;
20
21public enum PropertyType {
22
23 String,
24 Long,
25 Double,
26 Float,
27 Integer,
28 Byte,
29 Char,
30 Character,
31 Boolean,
Carsten Ziegeler48cc4b32013-01-25 10:01:52 +000032 Short,
Carsten Ziegelerd04ccae2013-05-08 13:04:39 +000033 Password;
Carsten Ziegeler55c96d32012-06-13 12:03:35 +000034
35 public static PropertyType from(final Class<?> javaClass) {
36 if ( javaClass.getName().equals(Long.class.getName())) {
37 return PropertyType.Long;
38 }
39 if ( javaClass.getName().equals(Double.class.getName())) {
40 return PropertyType.Double;
41 }
42 if ( javaClass.getName().equals(Float.class.getName())) {
43 return PropertyType.Float;
44 }
45 if ( javaClass.getName().equals(Integer.class.getName())) {
46 return PropertyType.Integer;
47 }
48 if ( javaClass.getName().equals(Byte.class.getName())) {
49 return PropertyType.Byte;
50 }
51 if ( javaClass.getName().equals(Character.class.getName())) {
52 return PropertyType.Character;
53 }
54 if ( javaClass.getName().equals(Boolean.class.getName())) {
55 return PropertyType.Boolean;
56 }
57 if ( javaClass.getName().equals(Short.class.getName())) {
58 return PropertyType.Short;
59 }
60 // default
61 return PropertyType.String;
62 }
63}