KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > hivemind > util > UtilMessages


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.hivemind.util;
16
17 import java.lang.reflect.Constructor JavaDoc;
18 import java.net.MalformedURLException JavaDoc;
19
20 import org.apache.hivemind.impl.MessageFormatter;
21
22 /**
23  * Messages for the util package.
24  *
25  * @author Howard Lewis Ship
26  */

27 class UtilMessages
28 {
29     protected static MessageFormatter _formatter = new MessageFormatter(UtilMessages.class);
30
31     static String JavaDoc noSuchProperty(Object JavaDoc target, String JavaDoc propertyName)
32     {
33         return _formatter.format("no-such-property", target.getClass().getName(), propertyName);
34     }
35
36     static String JavaDoc noMatchingConstructor(Class JavaDoc targetClass)
37     {
38         return _formatter.format("no-matching-constructor", targetClass.getName());
39     }
40
41     static String JavaDoc invokeFailed(Constructor JavaDoc constructor, Throwable JavaDoc cause)
42     {
43         return _formatter.format("invoke-failed", constructor.getDeclaringClass().getName(), cause);
44     }
45
46     static String JavaDoc noPropertyWriter(String JavaDoc propertyName, Object JavaDoc target)
47     {
48         return _formatter.format("no-writer", propertyName, target);
49     }
50
51     static String JavaDoc writeFailure(String JavaDoc propertyName, Object JavaDoc target, Throwable JavaDoc cause)
52     {
53         return _formatter.format("write-failure", new Object JavaDoc[]
54         { propertyName, target, cause });
55     }
56
57     static String JavaDoc noReader(String JavaDoc propertyName, Object JavaDoc target)
58     {
59         return _formatter.format("no-reader", propertyName, target);
60     }
61
62     static String JavaDoc readFailure(String JavaDoc propertyName, Object JavaDoc target, Throwable JavaDoc cause)
63     {
64         return _formatter.format("read-failure", propertyName, target, cause);
65     }
66
67     static String JavaDoc nullObject()
68     {
69         return _formatter.getMessage("null-object");
70     }
71
72     static String JavaDoc unableToIntrospect(Class JavaDoc targetClass, Throwable JavaDoc cause)
73     {
74         return _formatter.format("unable-to-introspect", targetClass.getName(), cause);
75     }
76
77     static String JavaDoc badFileURL(String JavaDoc path, Throwable JavaDoc cause)
78     {
79         return _formatter.format("bad-file-url", path, cause);
80     }
81
82     static String JavaDoc unableToReferenceContextPath(String JavaDoc path, MalformedURLException JavaDoc ex)
83     {
84         return _formatter.format("unable-to-reference-context-path", path, ex);
85     }
86
87     /** @since 1.1 */
88     static String JavaDoc noPropertyEditor(String JavaDoc propertyName, Class JavaDoc targetClass)
89     {
90         return _formatter.format("no-property-editor", propertyName, targetClass.getName());
91     }
92
93     /** @since 1.1 */
94     static String JavaDoc unableToConvert(String JavaDoc value, Class JavaDoc propertyType,
95
96     String JavaDoc propertyName, Object JavaDoc target, Throwable JavaDoc cause)
97     {
98         return _formatter.format("unable-to-convert", new Object JavaDoc[]
99         { value, propertyType.getName(), propertyName, target, cause });
100     }
101
102     /** @since 1.1 */
103     static String JavaDoc unableToInstantiateInstanceOfClass(Class JavaDoc clazz, Throwable JavaDoc cause)
104     {
105         return _formatter.format("unable-to-instantiate-instance-of-class", clazz.getName(), cause);
106     }
107     
108     /** @since 2.0 */
109     static String JavaDoc duplicateKeyInMap(Object JavaDoc key)
110     {
111         return _formatter.format("duplicate-key-in-map", key);
112     }
113
114 }
Popular Tags