|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
UtilMessages.java | - | 80% | 80% | 80% |
|
1 |
// Copyright 2004 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.io.File;
|
|
18 |
import java.lang.reflect.Constructor;
|
|
19 |
|
|
20 |
import org.apache.hivemind.HiveMind;
|
|
21 |
import org.apache.hivemind.impl.MessageFormatter;
|
|
22 |
|
|
23 |
/**
|
|
24 |
* Messages for the util package.
|
|
25 |
*
|
|
26 |
* @author Howard Lewis Ship
|
|
27 |
*/
|
|
28 |
final class UtilMessages
|
|
29 |
{ |
|
30 |
private static final MessageFormatter _formatter = |
|
31 |
new MessageFormatter(UtilMessages.class, "UtilStrings"); |
|
32 |
|
|
33 | 2 |
public static String noSuchProperty(Object target, String propertyName) |
34 |
{ |
|
35 | 2 |
return _formatter.format("no-such-property", target.getClass().getName(), propertyName); |
36 |
} |
|
37 |
|
|
38 | 1 |
public static String noMatchingConstructor(Class targetClass, Object location) |
39 |
{ |
|
40 | 1 |
return _formatter.format(
|
41 |
"no-matching-constructor",
|
|
42 |
targetClass.getName(), |
|
43 |
HiveMind.getLocationString(location)); |
|
44 |
} |
|
45 |
|
|
46 | 0 |
public static String invokeFailed(Constructor constructor, Object location, Throwable cause) |
47 |
{ |
|
48 | 0 |
return _formatter.format(
|
49 |
"invoke-failed",
|
|
50 |
constructor.getDeclaringClass().getName(), |
|
51 |
HiveMind.getLocationString(location), |
|
52 |
cause); |
|
53 |
} |
|
54 |
|
|
55 | 1 |
public static String noPropertyWriter(String propertyName, Object target) |
56 |
{ |
|
57 | 1 |
return _formatter.format("no-writer", propertyName, target); |
58 |
} |
|
59 |
|
|
60 | 2 |
public static String writeFailure(String propertyName, Object target, Throwable cause) |
61 |
{ |
|
62 | 2 |
return _formatter.format("write-failure", new Object[] { propertyName, target, cause }); |
63 |
} |
|
64 |
|
|
65 | 1 |
public static String noReader(String propertyName, Object target) |
66 |
{ |
|
67 | 1 |
return _formatter.format("no-reader", propertyName, target); |
68 |
} |
|
69 |
|
|
70 | 1 |
public static String readFailure(String propertyName, Object target, Throwable cause) |
71 |
{ |
|
72 | 1 |
return _formatter.format("read-failure", propertyName, target, cause); |
73 |
} |
|
74 |
|
|
75 | 1 |
public static String nullObject() |
76 |
{ |
|
77 | 1 |
return _formatter.getMessage("null-object"); |
78 |
} |
|
79 |
|
|
80 | 1 |
public static String unableToIntrospect(Class targetClass, Throwable cause) |
81 |
{ |
|
82 | 1 |
return _formatter.format("unable-to-introspect", targetClass.getName(), cause); |
83 |
} |
|
84 |
|
|
85 | 0 |
public static String badFileURL(String path, Throwable cause) |
86 |
{ |
|
87 | 0 |
return _formatter.format("bad-file-url", path, cause); |
88 |
} |
|
89 |
} |
|
90 |
|
|