/** * Implement the abstract methods present in a {@link Class} to the specified {@link MethodHolderSource} * * @param source the {@link Class} where the methods will be imported from * @param target the {@link MethodHolderSource} where the methods will be exported to * @return a {@link List} of the implemented methods added to the provided {@link MethodHolderSource} */ public static List<MethodSource<?>> implementAbstractMethods(final Class<?> source, final MethodHolderSource<?> target) { List<MethodSource<?>> methods = new ArrayList<MethodSource<?>>(); for (java.lang.reflect.Method m : source.getMethods()) { if (m.getDeclaringClass() == Object.class) continue; if (Modifier.isAbstract(m.getModifiers()) && target.getMethod(m.getName(), m.getParameterTypes()) == null) { MethodSource<?> newMethod = target.addMethod(m); implementMethod(newMethod); removeAllAnnotations(newMethod); methods.add(newMethod); } } return methods; }
/** * Implement the abstract methods present in a {@link Class} to the specified {@link MethodHolderSource} * * @param source the {@link Class} where the methods will be imported from * @param target the {@link MethodHolderSource} where the methods will be exported to * @return a {@link List} of the implemented methods added to the provided {@link MethodHolderSource} */ public static List<MethodSource<?>> implementAbstractMethods(final Class<?> source, final MethodHolderSource<?> target) { List<MethodSource<?>> methods = new ArrayList<MethodSource<?>>(); for (java.lang.reflect.Method m : source.getMethods()) { if (m.getDeclaringClass() == Object.class) continue; if (Modifier.isAbstract(m.getModifiers()) && target.getMethod(m.getName(), m.getParameterTypes()) == null) { MethodSource<?> newMethod = target.addMethod(m); implementMethod(newMethod); removeAllAnnotations(newMethod); methods.add(newMethod); } } return methods; }
/** * Implement the abstract methods present in a {@link MethodHolder} to the specified {@link MethodHolderSource} * * @param source the {@link MethodHolder} where the methods will be imported from * @param target the {@link MethodHolderSource} where the methods will be exported to * @return a {@link List} of the implemented methods added to the provided {@link MethodHolderSource} */ @SuppressWarnings({ "rawtypes", "unchecked" }) public static List<MethodSource<?>> implementAbstractMethods(final MethodHolder<?> source, final MethodHolderSource<?> target) { List<MethodSource<?>> methods = new ArrayList<MethodSource<?>>(); for (Method method : source.getMethods()) { if (method.isAbstract() && !target.hasMethod(method)) { MethodSource<?> newMethod = target.addMethod(method); implementMethod(newMethod); removeAllAnnotations(newMethod); methods.add(newMethod); } } return methods; }
/** * Implement the abstract methods present in a {@link MethodHolder} to the specified {@link MethodHolderSource} * * @param source the {@link MethodHolder} where the methods will be imported from * @param target the {@link MethodHolderSource} where the methods will be exported to * @return a {@link List} of the implemented methods added to the provided {@link MethodHolderSource} */ @SuppressWarnings({ "rawtypes", "unchecked" }) public static List<MethodSource<?>> implementAbstractMethods(final MethodHolder<?> source, final MethodHolderSource<?> target) { List<MethodSource<?>> methods = new ArrayList<MethodSource<?>>(); for (Method method : source.getMethods()) { if (method.isAbstract() && !target.hasMethod(method)) { MethodSource<?> newMethod = target.addMethod(method); implementMethod(newMethod); removeAllAnnotations(newMethod); methods.add(newMethod); } } return methods; }