private void dump(final Object o) { try { final Class<?> clazz = o.getClass(); for (final Field field : clazz.getDeclaredFields()) { SetAccessible.on(field); if (Collection.class.isAssignableFrom(field.getType())) { final Collection collection = (Collection) field.get(o); System.out.println(field.getName() + "\t= " + collection.size()); } } } catch (Exception e) { // no-op } }
private void dump(final Object o) { try { final Class<?> clazz = o.getClass(); for (final Field field : clazz.getDeclaredFields()) { SetAccessible.on(field); if (Collection.class.isAssignableFrom(field.getType())) { final Collection collection = (Collection) field.get(o); System.out.println(field.getName() + "\t= " + collection.size()); } } } catch (Exception e) { // no-op } }
private static void add(final ClassFinder finder, final Set<Method> methods, final Class<? extends Annotation> annotation) { final List<Method> annotatedMethods = finder.findAnnotatedMethods(annotation); for (final Method method : annotatedMethods) { SetAccessible.on(method); methods.add(method); } }
private static void add(final ClassFinder finder, final Set<Method> methods, final Class<? extends Annotation> annotation) { final List<Method> annotatedMethods = finder.findAnnotatedMethods(annotation); for (final Method method : annotatedMethods) { SetAccessible.on(method); methods.add(method); } }
/** * Used by toMethods and toCallbacks to find the nearest java.lang.reflect.Method with the given * name and parameters. Callbacks can be private so class.getMethod() cannot be used. Searching * starts by looking in the specified class, if the method is not found searching continues with * the immediate parent and continues recurssively until the method is found or java.lang.Object * is reached. If the method is not found a NoSuchMethodException is thrown. * * @param clazz * @param methodName * @param parameterTypes * @return * @throws NoSuchMethodException if the method is not found in this class or any of its parent classes */ private Method getMethod(Class<?> clazz, final String methodName, final Class<?>... parameterTypes) throws NoSuchMethodException { NoSuchMethodException original = null; while (clazz != null) { try { final Method method = clazz.getDeclaredMethod(methodName, parameterTypes); return SetAccessible.on(method); } catch (final NoSuchMethodException e) { if (original == null) { original = e; } } clazz = clazz.getSuperclass(); } throw original; }
/** * Finds the nearest java.lang.reflect.Method with the given * name and parameters. Callbacks can be private so class.getMethod() cannot be used. Searching * starts by looking in the specified class, if the method is not found searching continues with * the immediate parent and continues recurssively until the method is found or java.lang.Object * is reached. If the method is not found a NoSuchMethodException is thrown. * * @param clazz * @param methodName * @param parameterTypes * @return * @throws NoSuchMethodException if the method is not found in this class or any of its parent classes */ private Method getMethod(Class clazz, String methodName, Class... parameterTypes) throws NoSuchMethodException { NoSuchMethodException original = null; while (clazz != null){ try { Method method = clazz.getDeclaredMethod(methodName, parameterTypes); return SetAccessible.on(method); } catch (NoSuchMethodException e) { if (original == null) original = e; } clazz = clazz.getSuperclass(); } throw original; }
/** * Used by toMethods and toCallbacks to find the nearest java.lang.reflect.Method with the given * name and parameters. Callbacks can be private so class.getMethod() cannot be used. Searching * starts by looking in the specified class, if the method is not found searching continues with * the immediate parent and continues recurssively until the method is found or java.lang.Object * is reached. If the method is not found a NoSuchMethodException is thrown. * * @param clazz * @param methodName * @param parameterTypes * @return * @throws NoSuchMethodException if the method is not found in this class or any of its parent classes */ private Method getMethod(Class clazz, String methodName, Class... parameterTypes) throws NoSuchMethodException { NoSuchMethodException original = null; while (clazz != null){ try { Method method = clazz.getDeclaredMethod(methodName, parameterTypes); return SetAccessible.on(method); } catch (NoSuchMethodException e) { if (original == null) original = e; } clazz = clazz.getSuperclass(); } throw original; }
/** * Used by toMethods and toCallbacks to find the nearest java.lang.reflect.Method with the given * name and parameters. Callbacks can be private so class.getMethod() cannot be used. Searching * starts by looking in the specified class, if the method is not found searching continues with * the immediate parent and continues recurssively until the method is found or java.lang.Object * is reached. If the method is not found a NoSuchMethodException is thrown. * * @param clazz * @param methodName * @param parameterTypes * @return * @throws NoSuchMethodException if the method is not found in this class or any of its parent classes */ private Method getMethod(Class<?> clazz, final String methodName, final Class<?>... parameterTypes) throws NoSuchMethodException { NoSuchMethodException original = null; while (clazz != null) { try { final Method method = clazz.getDeclaredMethod(methodName, parameterTypes); return SetAccessible.on(method); } catch (final NoSuchMethodException e) { if (original == null) { original = e; } } clazz = clazz.getSuperclass(); } throw original; }
try { final Method method = clazz.getDeclaredMethod(info.methodName, parameters); return SetAccessible.on(method); } catch (final NoSuchMethodException e) { if (noSuchMethod == null) {
try { final Method method = clazz.getDeclaredMethod(info.methodName, parameters); return SetAccessible.on(method); } catch (final NoSuchMethodException e) { if (noSuchMethod == null) {
final Method p = objectClass.getDeclaredMethod(destroyMethod); if (!p.isAccessible()) { SetAccessible.on(p);
final Method p = objectClass.getDeclaredMethod(destroyMethod); if (!p.isAccessible()) { SetAccessible.on(p);
SetAccessible.on(method); methods.add(method);
SetAccessible.on(method); methods.add(method);
SetAccessible.on(method); methods.add(method);
SetAccessible.on(method); methods.add(method);
SetAccessible.on(method); methods.add(method);
@Override public synchronized void destroyResource() { if (destroyed) { return; } final Object o = unwrapReference(delegate); for (final Method m : preDestroys) { try { if (!m.isAccessible()) { SetAccessible.on(m); } m.invoke(o); } catch (final Exception e) { final Assembler component = SystemInstance.get().getComponent(Assembler.class); if (component != null) { component.logger.error(e.getMessage(), e); }else { System.err.println("" + e.getMessage()); } } } try { if (context != null) { context.release(); } } catch (final Exception e) { // no-op } destroyed = true; }
@Override public void destroyResource() { final Object o = unwrapReference(delegate); for (final Method m : preDestroys) { try { if (!m.isAccessible()) { SetAccessible.on(m); } m.invoke(o); } catch (final Exception e) { final Assembler assembler = SystemInstance.get().getComponent(Assembler.class); if (assembler != null) { assembler.getLogger().error(e.getMessage(), e); } } } try { if (context != null) { context.release(); } } catch (final Exception e) { // no-op } }