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