1 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 29 public class RulesMessages 30 { 31 32 protected static MessageFormatter _formatter = new MessageFormatter(RulesMessages.class); 33 34 public 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 public static String unableToSetProperty(String propertyName, Object target, Throwable cause) 43 { 44 return _formatter.format("unable-to-set-property", propertyName, target, cause); 45 } 46 47 public static String invalidBooleanValue(String inputValue) 48 { 49 return _formatter.format("invalid-boolean-value", inputValue); 50 } 51 52 public static String invalidDoubleValue(String inputValue) 53 { 54 return _formatter.format("invalid-double-value", inputValue); 55 } 56 57 public static String minDoubleValue(String inputValue, double minValue) 58 { 59 return _formatter.format("min-double-value", inputValue, new Double (minValue)); 60 } 61 62 public static String maxDoubleValue(String inputValue, double maxValue) 63 { 64 return _formatter.format("max-double-value", inputValue, new Double (maxValue)); 65 } 66 67 public static String enumNotRecognized(String inputValue) 68 { 69 return _formatter.format("enum-not-recognized", inputValue); 70 } 71 72 public static String enumError(Class enumClass, String fieldName, Throwable cause) 73 { 74 return _formatter.format("enum-error", enumClass.getName(), fieldName, cause); 75 } 76 77 public static String invalidIntValue(String inputValue) 78 { 79 return _formatter.format("invalid-int-value", inputValue); 80 } 81 82 public static String minIntValue(String inputValue, int minValue) 83 { 84 return _formatter.format("min-int-value", inputValue, new Integer (minValue)); 85 } 86 87 public static String maxIntValue(String inputValue, int maxValue) 88 { 89 return _formatter.format("max-int-value", inputValue, new Integer (maxValue)); 90 } 91 92 public 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.getClass().getName(), location, cause }); 97 } 98 99 public static String invalidLongValue(String inputValue) 100 { 101 return _formatter.format("invalid-long-value", inputValue); 102 } 103 104 public static String minLongValue(String inputValue, long minValue) 105 { 106 return _formatter.format("min-long-value", inputValue, new Long (minValue)); 107 } 108 109 public static String maxLongValue(String inputValue, long maxValue) 110 { 111 return _formatter.format("max-long-value", inputValue, new Long (maxValue)); 112 } 113 114 public 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 public static String readContentFailure(SchemaProcessor processor, Element element, Throwable cause) 122 { 123 return _formatter.format("read-content-failure", processor.getElementPath(), cause); 124 } 125 126 public static String resourceLocalizationError(String inputValue, Module contributingModule) 127 { 128 return _formatter.format("resource-localization-error", inputValue, contributingModule 129 .getModuleId()); 130 } 131 132 public static String invalidInitializer(String initializer) 133 { 134 return _formatter.format("invalid-initializer", initializer); 135 } 136 137 public static String noPropertyEditor(Class propertyType) 138 { 139 return _formatter.format("no-property-editor", propertyType.getName()); 140 } 141 142 public 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 } | Popular Tags |