1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| package org.apache.tapestry.enhance; |
16 |
| |
17 |
| import java.lang.reflect.Constructor; |
18 |
| import java.lang.reflect.Method; |
19 |
| |
20 |
| import org.apache.hivemind.impl.MessageFormatter; |
21 |
| import org.apache.hivemind.service.ClassFabUtils; |
22 |
| import org.apache.tapestry.IAsset; |
23 |
| import org.apache.tapestry.Tapestry; |
24 |
| |
25 |
| |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| class EnhanceMessages |
32 |
| { |
33 |
| protected static MessageFormatter _formatter = new MessageFormatter(EnhanceMessages.class, |
34 |
| "EnhanceStrings"); |
35 |
| |
36 |
1
| static String noImplForAbstractMethod(Method method, Class declareClass, String className,
|
37 |
| Class enhancedClass) |
38 |
| { |
39 |
1
| return _formatter.format("no-impl-for-abstract-method", new Object[]
|
40 |
| { method, declareClass.getName(), className, enhancedClass.getName() }); |
41 |
| } |
42 |
| |
43 |
0
| static String unabelToIntrospectClass(Class targetClass, Throwable cause)
|
44 |
| { |
45 |
0
| return _formatter.format("unable-to-introspect-class", targetClass.getName(), cause);
|
46 |
| } |
47 |
| |
48 |
2
| static String propertyTypeMismatch(Class componentClass, String propertyName,
|
49 |
| Class actualPropertyType, Class expectedPropertyType) |
50 |
| { |
51 |
2
| return _formatter.format("property-type-mismatch", new Object[]
|
52 |
| { componentClass.getName(), propertyName, |
53 |
| ClassFabUtils.getJavaClassName(actualPropertyType), |
54 |
| ClassFabUtils.getJavaClassName(expectedPropertyType) }); |
55 |
| } |
56 |
| |
57 |
15
| static String errorAddingProperty(String propertyName, Class componentClass, Throwable cause)
|
58 |
| { |
59 |
15
| return _formatter.format(
|
60 |
| "error-adding-property", |
61 |
| propertyName, |
62 |
| componentClass.getName(), |
63 |
| cause); |
64 |
| } |
65 |
| |
66 |
7
| static String claimedProperty(String propertyName)
|
67 |
| { |
68 |
7
| return _formatter.format("claimed-property", propertyName);
|
69 |
| } |
70 |
| |
71 |
1
| static String instantiationFailure(Constructor c, Object[] parameters, String classFab,
|
72 |
| Throwable cause) |
73 |
| { |
74 |
1
| int count = Tapestry.size(parameters);
|
75 |
1
| StringBuffer buffer = new StringBuffer("[");
|
76 |
1
| for (int i = 0; i < count; i++)
|
77 |
| { |
78 |
1
| if (i > 0)
|
79 |
0
| buffer.append(", ");
|
80 |
1
| buffer.append(parameters[i]);
|
81 |
| } |
82 |
| |
83 |
1
| buffer.append("]");
|
84 |
| |
85 |
1
| return _formatter.format("instantiation-failure", new Object[]
|
86 |
| { c.getDeclaringClass().getName(), c, buffer.toString(), classFab, cause }); |
87 |
| } |
88 |
| |
89 |
1
| static String locatedValueIsNull(String objectReference)
|
90 |
| { |
91 |
1
| return _formatter.format("located-value-is-null", objectReference);
|
92 |
| } |
93 |
| |
94 |
1
| static String incompatibleInjectType(String locator, Object value, Class propertyType)
|
95 |
| { |
96 |
1
| return _formatter.format("incompatible-inject-type", locator, value, ClassFabUtils
|
97 |
| .getJavaClassName(propertyType)); |
98 |
| } |
99 |
| |
100 |
5
| static String initialValueForProperty(String propertyName)
|
101 |
| { |
102 |
5
| return _formatter.format("initial-value-for-property", propertyName);
|
103 |
| } |
104 |
| |
105 |
2
| static String unknownInjectType(String propertyName, String injectType)
|
106 |
| { |
107 |
2
| return _formatter.format("unknown-inject-type", propertyName, injectType);
|
108 |
| } |
109 |
| |
110 |
1
| static String wrongTypeForProperty(String propertyName, Class propertyType, Class requiredType)
|
111 |
| { |
112 |
1
| return _formatter.format("wrong-type-for-property", propertyName, ClassFabUtils
|
113 |
| .getJavaClassName(propertyType), ClassFabUtils.getJavaClassName(requiredType)); |
114 |
| } |
115 |
| |
116 |
1
| public static String wrongTypeForPageInjection(String propertyName, Class propertyType)
|
117 |
| { |
118 |
1
| return _formatter.format("wrong-type-for-page-injection", propertyName, ClassFabUtils
|
119 |
| .getJavaClassName(propertyType)); |
120 |
| } |
121 |
| |
122 |
1
| public static String incompatiblePropertyType(String propertyName, Class propertyType,
|
123 |
| Class expectedType) |
124 |
| { |
125 |
1
| return _formatter.format("incompatible-property-type", propertyName, ClassFabUtils
|
126 |
| .getJavaClassName(propertyType), ClassFabUtils.getJavaClassName(expectedType)); |
127 |
| } |
128 |
| |
129 |
1
| public static String classEnhancementFailure(Class baseClass, Throwable cause)
|
130 |
| { |
131 |
1
| return _formatter.format("class-enhancement-failure", ClassFabUtils
|
132 |
| .getJavaClassName(baseClass), cause); |
133 |
| } |
134 |
| |
135 |
| } |