1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| package org.apache.hivemind.schema.rules; |
16 |
| |
17 |
| import org.apache.hivemind.Element; |
18 |
| import org.apache.hivemind.HiveMind; |
19 |
| import org.apache.hivemind.Location; |
20 |
| import org.apache.hivemind.impl.MessageFormatter; |
21 |
| import org.apache.hivemind.internal.Module; |
22 |
| import org.apache.hivemind.schema.SchemaProcessor; |
23 |
| |
24 |
| |
25 |
| |
26 |
| |
27 |
| |
28 |
| |
29 |
| class RulesMessages |
30 |
| { |
31 |
| |
32 |
| protected static MessageFormatter _formatter = new MessageFormatter(RulesMessages.class); |
33 |
| |
34 |
0
| static String unableToSetElementProperty(String propertyName, Object target,
|
35 |
| SchemaProcessor processor, Element element, Throwable cause) |
36 |
| { |
37 |
0
| return _formatter.format("unable-to-set-element-property", new Object[]
|
38 |
| { propertyName, target, processor.getElementPath(), HiveMind.getLocationString(element), |
39 |
| cause }); |
40 |
| } |
41 |
| |
42 |
0
| static String unableToSetProperty(String propertyName, Object target, Throwable cause)
|
43 |
| { |
44 |
0
| return _formatter.format("unable-to-set-property", propertyName, target, cause);
|
45 |
| } |
46 |
| |
47 |
1
| static String invalidBooleanValue(String inputValue)
|
48 |
| { |
49 |
1
| return _formatter.format("invalid-boolean-value", inputValue);
|
50 |
| } |
51 |
| |
52 |
1
| static String invalidDoubleValue(String inputValue)
|
53 |
| { |
54 |
1
| return _formatter.format("invalid-double-value", inputValue);
|
55 |
| } |
56 |
| |
57 |
2
| static String minDoubleValue(String inputValue, double minValue)
|
58 |
| { |
59 |
2
| return _formatter.format("min-double-value", inputValue, new Double(minValue));
|
60 |
| } |
61 |
| |
62 |
2
| static String maxDoubleValue(String inputValue, double maxValue)
|
63 |
| { |
64 |
2
| return _formatter.format("max-double-value", inputValue, new Double(maxValue));
|
65 |
| } |
66 |
| |
67 |
1
| static String enumNotRecognized(String inputValue)
|
68 |
| { |
69 |
1
| return _formatter.format("enum-not-recognized", inputValue);
|
70 |
| } |
71 |
| |
72 |
1
| static String enumError(Class enumClass, String fieldName, Throwable cause)
|
73 |
| { |
74 |
1
| return _formatter.format("enum-error", enumClass.getName(), fieldName, cause);
|
75 |
| } |
76 |
| |
77 |
2
| static String invalidIntValue(String inputValue)
|
78 |
| { |
79 |
2
| return _formatter.format("invalid-int-value", inputValue);
|
80 |
| } |
81 |
| |
82 |
3
| static String minIntValue(String inputValue, int minValue)
|
83 |
| { |
84 |
3
| return _formatter.format("min-int-value", inputValue, new Integer(minValue));
|
85 |
| } |
86 |
| |
87 |
3
| static String maxIntValue(String inputValue, int maxValue)
|
88 |
| { |
89 |
3
| return _formatter.format("max-int-value", inputValue, new Integer(maxValue));
|
90 |
| } |
91 |
| |
92 |
2
| static String errorInvokingMethod(String methodName, Object parent, Location location,
|
93 |
| Throwable cause) |
94 |
| { |
95 |
2
| return _formatter.format("error-invoking-method", new Object[]
|
96 |
| { methodName, parent, location, cause }); |
97 |
| } |
98 |
| |
99 |
1
| static String invalidLongValue(String inputValue)
|
100 |
| { |
101 |
1
| return _formatter.format("invalid-long-value", inputValue);
|
102 |
| } |
103 |
| |
104 |
2
| static String minLongValue(String inputValue, long minValue)
|
105 |
| { |
106 |
2
| return _formatter.format("min-long-value", inputValue, new Long(minValue));
|
107 |
| } |
108 |
| |
109 |
2
| static String maxLongValue(String inputValue, long maxValue)
|
110 |
| { |
111 |
2
| return _formatter.format("max-long-value", inputValue, new Long(maxValue));
|
112 |
| } |
113 |
| |
114 |
4
| static String readAttributeFailure(String attributeName, Element element,
|
115 |
| SchemaProcessor processor, Throwable cause) |
116 |
| { |
117 |
4
| return _formatter.format("read-attribute-failure", new Object[]
|
118 |
| { attributeName, processor.getElementPath(), cause }); |
119 |
| } |
120 |
| |
121 |
2
| static String readContentFailure(SchemaProcessor processor, Element element, Throwable cause)
|
122 |
| { |
123 |
2
| return _formatter.format("read-content-failure", processor.getElementPath(), cause);
|
124 |
| } |
125 |
| |
126 |
1
| static String resourceLocalizationError(String inputValue, Module contributingModule)
|
127 |
| { |
128 |
1
| return _formatter.format("resource-localization-error", inputValue, contributingModule
|
129 |
| .getModuleId()); |
130 |
| } |
131 |
| |
132 |
1
| static String invalidInitializer(String initializer)
|
133 |
| { |
134 |
1
| return _formatter.format("invalid-initializer", initializer);
|
135 |
| } |
136 |
| |
137 |
1
| static String noPropertyEditor(Class propertyType)
|
138 |
| { |
139 |
1
| return _formatter.format("no-property-editor", propertyType.getName());
|
140 |
| } |
141 |
| |
142 |
1
| static String smartTranslatorError(String inputValue, Class propertyType, Throwable cause)
|
143 |
| { |
144 |
1
| return _formatter.format(
|
145 |
| "smart-translator-error", |
146 |
| inputValue, |
147 |
| propertyType.getName(), |
148 |
| cause); |
149 |
| } |
150 |
| } |