* @param method method to be generated
* @throws UnableToCompleteException
*/
protected void delegateToCreator(TreeLogger logger, JMethod method)
throws UnableToCompleteException {
AbstractMethodCreator methodCreator = getMethodCreator(logger, method);
String key = getKey(logger, method);
String value;
try {
value = messageBindings.getString(key);
} catch (MissingResourceException e) {
String s = "Could not find requested resource key '" + key + "'";
TreeLogger child = logger.branch(TreeLogger.ERROR, s, null);
Set keys = messageBindings.keySet();
if (keys.size() < AbstractResource.REPORT_KEYS_THRESHOLD) {
String keyString = "Keys found: " + keys;
throw error(child, keyString);
} else {
throw new UnableToCompleteException();
}
}
String localeString;
if (messageBindings.getLocale() == null
|| messageBindings.getLocale().toString().equals("")) {
localeString = "default";
} else {
localeString = messageBindings.getLocale().toString();
}
String info = "When locale is '" + localeString + "', property '" + key
+ "' has the value '" + value + "'";
TreeLogger branch = logger.branch(TreeLogger.TRACE, info, null);
methodCreator.createMethodFor(branch, method, value);
}