Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static AccessibleObject findInjectionTarget(ClassLoader loader, ResourceInjectionTargetMetaData target)
- {
- Class<?> clazz = null;
- try
- {
- clazz = loader.loadClass(target.getInjectionTargetClass());
- }
- catch (ClassNotFoundException e)
- {
- throw new RuntimeException("<injection-target> class: " + target.getInjectionTargetClass() + " was not found in deployment");
- }
- for (Field field : clazz.getDeclaredFields())
- {
- if (target.getInjectionTargetName().equals(field.getName())) return field;
- }
- for (java.lang.reflect.Method method : clazz.getDeclaredMethods())
- {
- if (method.getName().equals(target.getInjectionTargetName())) return method;
- }
- throw new RuntimeException("<injection-target> could not be found: " + target.getInjectionTargetClass() + "." + target.getInjectionTargetName());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement