/** * Compare generic parameter types of two methods. * * @param ts generic parameter types of the first method. * @param _ts generic parameter types of the second method. * @return {@code true} if the given types are understood to be equal, {@code false} otherwise. * @see #compareParameterTypes(java.lang.reflect.Type, java.lang.reflect.Type) */ private static boolean compareParameterTypes(final Type[] ts, final Type[] _ts) { for (int i = 0; i < ts.length; i++) { if (!ts[i].equals(_ts[i])) { if (!compareParameterTypes(ts[i], _ts[i])) { return false; } } } return true; }
/** * Compare generic parameter types of two methods. * * @param ts generic parameter types of the first method. * @param _ts generic parameter types of the second method. * @return {@code true} if the given types are understood to be equal, {@code false} otherwise. * @see #compareParameterTypes(java.lang.reflect.Type, java.lang.reflect.Type) */ private static boolean compareParameterTypes(final Type[] ts, final Type[] _ts) { for (int i = 0; i < ts.length; i++) { if (!ts[i].equals(_ts[i])) { if (!compareParameterTypes(ts[i], _ts[i])) { return false; } } } return true; }
/** * Find a {@link Method method} that overrides the given {@code method} on the given {@link Class class}. * * @param clazz class to find overriding method on. * @param method an abstract method to find implementing method for. * @return method that overrides the given method or the given method itself if a better alternative cannot be found. */ public static Method findOverridingMethodOnClass(final Class<?> clazz, final Method method) { for (final Method _method : _getMethods(clazz)) { if (!_method.isBridge() && !Modifier.isAbstract(_method.getModifiers()) && _method.getName().equals(method.getName()) && _method.getParameterTypes().length == method.getParameterTypes().length) { if (compareParameterTypes(_method.getGenericParameterTypes(), method.getGenericParameterTypes())) { return _method; } } } if (method.isBridge() || Modifier.isAbstract(method.getModifiers())) { LOGGER.log(Level.INFO, LocalizationMessages.OVERRIDING_METHOD_CANNOT_BE_FOUND(method, clazz)); } return method; }
/** * Find a {@link Method method} that overrides the given {@code method} on the given {@link Class class}. * * @param clazz class to find overriding method on. * @param method an abstract method to find implementing method for. * @return method that overrides the given method or the given method itself if a better alternative cannot be found. */ public static Method findOverridingMethodOnClass(final Class<?> clazz, final Method method) { for (final Method _method : _getMethods(clazz)) { if (!_method.isBridge() && !Modifier.isAbstract(_method.getModifiers()) && _method.getName().equals(method.getName()) && _method.getParameterTypes().length == method.getParameterTypes().length) { if (compareParameterTypes(_method.getGenericParameterTypes(), method.getGenericParameterTypes())) { return _method; } } } if (method.isBridge() || Modifier.isAbstract(method.getModifiers())) { LOGGER.log(Level.INFO, LocalizationMessages.OVERRIDING_METHOD_CANNOT_BE_FOUND(method, clazz)); } return method; }
/** * Compare generic parameter types of two methods. * * @param ts generic parameter types of the first method. * @param _ts generic parameter types of the second method. * @return {@code true} if the given types are understood to be equal, {@code false} otherwise. * @see #compareParameterTypes(java.lang.reflect.Type, java.lang.reflect.Type) */ private static boolean compareParameterTypes(final Type[] ts, final Type[] _ts) { for (int i = 0; i < ts.length; i++) { if (!ts[i].equals(_ts[i])) { if (!compareParameterTypes(ts[i], _ts[i])) { return false; } } } return true; }
/** * Compare generic parameter types of two methods. * * @param ts generic parameter types of the first method. * @param _ts generic parameter types of the second method. * @return {@code true} if the given types are understood to be equal, {@code false} otherwise. * @see #compareParameterTypes(java.lang.reflect.Type, java.lang.reflect.Type) */ private static boolean compareParameterTypes(final Type[] ts, final Type[] _ts) { for (int i = 0; i < ts.length; i++) { if (!ts[i].equals(_ts[i])) { if (!compareParameterTypes(ts[i], _ts[i])) { return false; } } } return true; }
/** * Compare generic parameter types of two methods. * * @param ts generic parameter types of the first method. * @param _ts generic parameter types of the second method. * @return {@code true} if the given types are understood to be equal, {@code false} otherwise. * @see #compareParameterTypes(java.lang.reflect.Type, java.lang.reflect.Type) */ private static boolean compareParameterTypes(final Type[] ts, final Type[] _ts) { for (int i = 0; i < ts.length; i++) { if (!ts[i].equals(_ts[i])) { if (!compareParameterTypes(ts[i], _ts[i])) { return false; } } } return true; }
/** * Compare generic parameter types of two methods. * * @param ts generic parameter types of the first method. * @param _ts generic parameter types of the second method. * @return {@code true} if the given types are understood to be equal, {@code false} otherwise. * @see #compareParameterTypes(java.lang.reflect.Type, java.lang.reflect.Type) */ private static boolean compareParameterTypes(final Type[] ts, final Type[] _ts) { for (int i = 0; i < ts.length; i++) { if (!ts[i].equals(_ts[i])) { if (!compareParameterTypes(ts[i], _ts[i])) { return false; } } } return true; }
/** * Compare generic parameter types of two methods. * * @param ts generic parameter types of the first method. * @param _ts generic parameter types of the second method. * @return {@code true} if the given types are understood to be equal, {@code false} otherwise. * @see #compareParameterTypes(java.lang.reflect.Type, java.lang.reflect.Type) */ private static boolean compareParameterTypes(final Type[] ts, final Type[] _ts) { for (int i = 0; i < ts.length; i++) { if (!ts[i].equals(_ts[i])) { if (!compareParameterTypes(ts[i], _ts[i])) { return false; } } } return true; }
/** * Find a {@link Method method} that overrides the given {@code method} on the given {@link Class class}. * * @param clazz class to find overriding method on. * @param method an abstract method to find implementing method for. * @return method that overrides the given method or the given method itself if a better alternative cannot be found. */ public static Method findOverridingMethodOnClass(final Class<?> clazz, final Method method) { for (final Method _method : _getMethods(clazz)) { if (!_method.isBridge() && !Modifier.isAbstract(_method.getModifiers()) && _method.getName().equals(method.getName()) && _method.getParameterTypes().length == method.getParameterTypes().length) { if (compareParameterTypes(_method.getGenericParameterTypes(), method.getGenericParameterTypes())) { return _method; } } } if (method.isBridge() || Modifier.isAbstract(method.getModifiers())) { LOGGER.log(Level.INFO, LocalizationMessages.OVERRIDING_METHOD_CANNOT_BE_FOUND(method, clazz)); } return method; }
/** * Find a {@link Method method} that overrides the given {@code method} on the given {@link Class class}. * * @param clazz class to find overriding method on. * @param method an abstract method to find implementing method for. * @return method that overrides the given method or the given method itself if a better alternative cannot be found. */ public static Method findOverridingMethodOnClass(final Class<?> clazz, final Method method) { for (final Method _method : _getMethods(clazz)) { if (!_method.isBridge() && !Modifier.isAbstract(_method.getModifiers()) && _method.getName().equals(method.getName()) && _method.getParameterTypes().length == method.getParameterTypes().length) { if (compareParameterTypes(_method.getGenericParameterTypes(), method.getGenericParameterTypes())) { return _method; } } } if (method.isBridge() || Modifier.isAbstract(method.getModifiers())) { LOGGER.log(Level.INFO, LocalizationMessages.OVERRIDING_METHOD_CANNOT_BE_FOUND(method, clazz)); } return method; }
/** * Find a {@link Method method} that overrides the given {@code method} on the given {@link Class class}. * * @param clazz class to find overriding method on. * @param method an abstract method to find implementing method for. * @return method that overrides the given method or the given method itself if a better alternative cannot be found. */ public static Method findOverridingMethodOnClass(final Class<?> clazz, final Method method) { for (final Method _method : _getMethods(clazz)) { if (!_method.isBridge() && !Modifier.isAbstract(_method.getModifiers()) && _method.getName().equals(method.getName()) && _method.getParameterTypes().length == method.getParameterTypes().length) { if (compareParameterTypes(_method.getGenericParameterTypes(), method.getGenericParameterTypes())) { return _method; } } } if (method.isBridge() || Modifier.isAbstract(method.getModifiers())) { LOGGER.log(Level.INFO, LocalizationMessages.OVERRIDING_METHOD_CANNOT_BE_FOUND(method, clazz)); } return method; }
/** * Find a {@link Method method} that overrides the given {@code method} on the given {@link Class class}. * * @param clazz class to find overriding method on. * @param method an abstract method to find implementing method for. * @return method that overrides the given method or the given method itself if a better alternative cannot be found. */ public static Method findOverridingMethodOnClass(final Class<?> clazz, final Method method) { for (final Method _method : _getMethods(clazz)) { if (!_method.isBridge() && !Modifier.isAbstract(_method.getModifiers()) && _method.getName().equals(method.getName()) && _method.getParameterTypes().length == method.getParameterTypes().length) { if (compareParameterTypes(_method.getGenericParameterTypes(), method.getGenericParameterTypes())) { return _method; } } } if (method.isBridge() || Modifier.isAbstract(method.getModifiers())) { LOGGER.log(Level.INFO, LocalizationMessages.OVERRIDING_METHOD_CANNOT_BE_FOUND(method, clazz)); } return method; }
/** * Find a {@link Method method} that overrides the given {@code method} on the given {@link Class class}. * * @param clazz class to find overriding method on. * @param method an abstract method to find implementing method for. * @return method that overrides the given method or the given method itself if a better alternative cannot be found. */ public static Method findOverridingMethodOnClass(final Class<?> clazz, final Method method) { for (final Method _method : _getMethods(clazz)) { if (!_method.isBridge() && !Modifier.isAbstract(_method.getModifiers()) && _method.getName().equals(method.getName()) && _method.getParameterTypes().length == method.getParameterTypes().length) { if (compareParameterTypes(_method.getGenericParameterTypes(), method.getGenericParameterTypes())) { return _method; } } } if (method.isBridge() || Modifier.isAbstract(method.getModifiers())) { LOGGER.log(Level.INFO, LocalizationMessages.OVERRIDING_METHOD_CANNOT_BE_FOUND(method, clazz)); } return method; }