1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| package org.apache.hivemind.util; |
16 |
| |
17 |
| import java.lang.reflect.Constructor; |
18 |
| import java.net.MalformedURLException; |
19 |
| |
20 |
| import org.apache.hivemind.impl.MessageFormatter; |
21 |
| |
22 |
| |
23 |
| |
24 |
| |
25 |
| |
26 |
| |
27 |
| class UtilMessages |
28 |
| { |
29 |
| protected static MessageFormatter _formatter = new MessageFormatter(UtilMessages.class); |
30 |
| |
31 |
2
| static String noSuchProperty(Object target, String propertyName)
|
32 |
| { |
33 |
2
| return _formatter.format("no-such-property", target.getClass().getName(), propertyName);
|
34 |
| } |
35 |
| |
36 |
0
| static String noMatchingConstructor(Class targetClass)
|
37 |
| { |
38 |
0
| return _formatter.format("no-matching-constructor", targetClass.getName());
|
39 |
| } |
40 |
| |
41 |
2
| static String invokeFailed(Constructor constructor, Throwable cause)
|
42 |
| { |
43 |
2
| return _formatter.format("invoke-failed", constructor.getDeclaringClass().getName(), cause);
|
44 |
| } |
45 |
| |
46 |
1
| static String noPropertyWriter(String propertyName, Object target)
|
47 |
| { |
48 |
1
| return _formatter.format("no-writer", propertyName, target);
|
49 |
| } |
50 |
| |
51 |
2
| static String writeFailure(String propertyName, Object target, Throwable cause)
|
52 |
| { |
53 |
2
| return _formatter.format("write-failure", new Object[]
|
54 |
| { propertyName, target, cause }); |
55 |
| } |
56 |
| |
57 |
1
| static String noReader(String propertyName, Object target)
|
58 |
| { |
59 |
1
| return _formatter.format("no-reader", propertyName, target);
|
60 |
| } |
61 |
| |
62 |
1
| static String readFailure(String propertyName, Object target, Throwable cause)
|
63 |
| { |
64 |
1
| return _formatter.format("read-failure", propertyName, target, cause);
|
65 |
| } |
66 |
| |
67 |
1
| static String nullObject()
|
68 |
| { |
69 |
1
| return _formatter.getMessage("null-object");
|
70 |
| } |
71 |
| |
72 |
1
| static String unableToIntrospect(Class targetClass, Throwable cause)
|
73 |
| { |
74 |
1
| return _formatter.format("unable-to-introspect", targetClass.getName(), cause);
|
75 |
| } |
76 |
| |
77 |
0
| static String badFileURL(String path, Throwable cause)
|
78 |
| { |
79 |
0
| return _formatter.format("bad-file-url", path, cause);
|
80 |
| } |
81 |
| |
82 |
0
| static String unableToReferenceContextPath(String path, MalformedURLException ex)
|
83 |
| { |
84 |
0
| return _formatter.format("unable-to-reference-context-path", path, ex);
|
85 |
| } |
86 |
| |
87 |
| |
88 |
1
| static String noPropertyEditor(String propertyName, Class targetClass)
|
89 |
| { |
90 |
1
| return _formatter.format("no-property-editor", propertyName, targetClass.getName());
|
91 |
| } |
92 |
| |
93 |
| |
94 |
2
| static String unableToConvert(String value, Class propertyType,
|
95 |
| |
96 |
| String propertyName, Object target, Throwable cause) |
97 |
| { |
98 |
2
| return _formatter.format("unable-to-convert", new Object[]
|
99 |
| { value, propertyType.getName(), propertyName, target, cause }); |
100 |
| } |
101 |
| |
102 |
| |
103 |
4
| static String unableToInstantiateInstanceOfClass(Class clazz, Throwable cause)
|
104 |
| { |
105 |
4
| return _formatter.format("unable-to-instantiate-instance-of-class", clazz.getName(), cause);
|
106 |
| } |
107 |
| } |