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