public void inject(Object aComponent) {
if (aComponent != null) {
if (!clazz.isInstance(aComponent)) {
- throw new RuntimeException("Object '" + aComponent +
+ throw new IllegalArgumentException("Object '" + aComponent +
"' is of type " + aComponent.getClass().getName() +
" but expected " + clazz.getName());
}