KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > enhance > EnhanceMessages


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.lang.reflect.Constructor JavaDoc;
18 import java.lang.reflect.Method JavaDoc;
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  * Messages for this package.
27  *
28  * @author Howard Lewis Ship
29  * @since 4.0
30  */

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