|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
JavaClassMapping.java | - | 100% | 100% | 100% |
|
1 |
// Copyright 2004, 2005 The Apache Software Foundation
|
|
2 |
//
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
5 |
// You may obtain a copy of the License at
|
|
6 |
//
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8 |
//
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12 |
// See the License for the specific language governing permissions and
|
|
13 |
// limitations under the License.
|
|
14 |
|
|
15 |
package org.apache.tapestry.enhance;
|
|
16 |
|
|
17 |
import java.util.HashMap;
|
|
18 |
import java.util.Map;
|
|
19 |
|
|
20 |
/**
|
|
21 |
* @author Mindbridge
|
|
22 |
* @since 3.0
|
|
23 |
*/
|
|
24 |
public class JavaClassMapping |
|
25 |
{ |
|
26 |
|
|
27 |
/**
|
|
28 |
* Map of type (as Class), keyed on type name.
|
|
29 |
*
|
|
30 |
*/
|
|
31 |
|
|
32 |
private Map _typeMap = new HashMap(); |
|
33 |
|
|
34 |
{ |
|
35 | 562 |
recordType("boolean", boolean.class); |
36 | 562 |
recordType("boolean[]", boolean[].class); |
37 |
|
|
38 | 562 |
recordType("short", short.class); |
39 | 562 |
recordType("short[]", short[].class); |
40 |
|
|
41 | 562 |
recordType("int", int.class); |
42 | 562 |
recordType("int[]", int[].class); |
43 |
|
|
44 | 562 |
recordType("long", long.class); |
45 | 562 |
recordType("long[]", long[].class); |
46 |
|
|
47 | 562 |
recordType("float", float.class); |
48 | 562 |
recordType("float[]", float[].class); |
49 |
|
|
50 | 562 |
recordType("double", double.class); |
51 | 562 |
recordType("double[]", double[].class); |
52 |
|
|
53 | 562 |
recordType("char", char.class); |
54 | 562 |
recordType("char[]", char[].class); |
55 |
|
|
56 | 562 |
recordType("byte", byte.class); |
57 | 562 |
recordType("byte[]", byte[].class); |
58 |
|
|
59 | 562 |
recordType("java.lang.Object", Object.class); |
60 | 562 |
recordType("java.lang.Object[]", Object[].class); |
61 |
|
|
62 | 562 |
recordType("java.lang.String", String.class); |
63 | 562 |
recordType("java.lang.String[]", String[].class); |
64 |
} |
|
65 |
|
|
66 | 11265 |
public void recordType(String name, Class type) |
67 |
{ |
|
68 | 11265 |
_typeMap.put(name, type); |
69 |
} |
|
70 |
|
|
71 | 106 |
public Class getType(String name)
|
72 |
{ |
|
73 | 106 |
return (Class) _typeMap.get(name);
|
74 |
} |
|
75 |
|
|
76 |
} |
|
77 |
|
|