if ("outer".equals(name)) {
return outer;
} else {
if (bindingsByName.containsKey(name)) {
Binding binding = bindingsByName.get(name);
if (context == null) {
StringBuilderDocument document = new StringBuilderDocument();
// TODO:
// binding.describe(new ParaContentsDocument(document));
throw new BindingException("Failed to resolve "
+ document.toString()
+ " due to incomplete context.");
}
try {
return binding.get(context);
} catch (IllegalArgumentException e) {
throw new BindingException("Failed to bind to "
+ binding.getName(), e);
} catch (IllegalAccessException e) {
throw new BindingException("Forbidded to access "
+ binding.getName(), e);
}
} else {
throw new BindingException("Failed to resolve " + name
+ " on " + context.getClass());
}