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