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