1 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 27 class UtilMessages 28 { 29 protected static MessageFormatter _formatter = new MessageFormatter(UtilMessages.class); 30 31 static String noSuchProperty(Object target, String propertyName) 32 { 33 return _formatter.format("no-such-property", target.getClass().getName(), propertyName); 34 } 35 36 static String noMatchingConstructor(Class targetClass) 37 { 38 return _formatter.format("no-matching-constructor", targetClass.getName()); 39 } 40 41 static String invokeFailed(Constructor constructor, Throwable cause) 42 { 43 return _formatter.format("invoke-failed", constructor.getDeclaringClass().getName(), cause); 44 } 45 46 static String noPropertyWriter(String propertyName, Object target) 47 { 48 return _formatter.format("no-writer", propertyName, target); 49 } 50 51 static String writeFailure(String propertyName, Object target, Throwable cause) 52 { 53 return _formatter.format("write-failure", new Object [] 54 { propertyName, target, cause }); 55 } 56 57 static String noReader(String propertyName, Object target) 58 { 59 return _formatter.format("no-reader", propertyName, target); 60 } 61 62 static String readFailure(String propertyName, Object target, Throwable cause) 63 { 64 return _formatter.format("read-failure", propertyName, target, cause); 65 } 66 67 static String nullObject() 68 { 69 return _formatter.getMessage("null-object"); 70 } 71 72 static String unableToIntrospect(Class targetClass, Throwable cause) 73 { 74 return _formatter.format("unable-to-introspect", targetClass.getName(), cause); 75 } 76 77 static String badFileURL(String path, Throwable cause) 78 { 79 return _formatter.format("bad-file-url", path, cause); 80 } 81 82 static String unableToReferenceContextPath(String path, MalformedURLException ex) 83 { 84 return _formatter.format("unable-to-reference-context-path", path, ex); 85 } 86 87 88 static String noPropertyEditor(String propertyName, Class targetClass) 89 { 90 return _formatter.format("no-property-editor", propertyName, targetClass.getName()); 91 } 92 93 94 static String unableToConvert(String value, Class propertyType, 95 96 String propertyName, Object target, Throwable cause) 97 { 98 return _formatter.format("unable-to-convert", new Object [] 99 { value, propertyType.getName(), propertyName, target, cause }); 100 } 101 102 103 static String unableToInstantiateInstanceOfClass(Class clazz, Throwable cause) 104 { 105 return _formatter.format("unable-to-instantiate-instance-of-class", clazz.getName(), cause); 106 } 107 108 109 static String duplicateKeyInMap(Object key) 110 { 111 return _formatter.format("duplicate-key-in-map", key); 112 } 113 114 } | Popular Tags |