public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (!String.class.equals(method.getReturnType())) {
return "Invalid return type of the method " + method.toString(); //$NON-NLS-1$
}
//first, try to use the annotation if there is one.
Key k = method.getAnnotation(Key.class);
String result = null;
if (k != null) {
result = buildMessage(k.value(), method, args);
}
if (result == null) {
result = buildMessage(method.getName(), method, args);
}
return result;