mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
fix code
This commit is contained in:
parent
8cf3015075
commit
10f3abfeb8
@ -256,7 +256,7 @@ public abstract class AbstractTypeAnnotationScanner<T extends AbstractTypeAnnota
|
||||
*/
|
||||
protected Class<?> convert(Class<?> target) {
|
||||
if (hasConverters) {
|
||||
for (UnaryOperator<Class<?>> converter : converters) {
|
||||
for (final UnaryOperator<Class<?>> converter : converters) {
|
||||
target = converter.apply(target);
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public interface AnnotationScanner {
|
||||
*/
|
||||
default void scan(BiConsumer<Integer, Annotation> consumer, AnnotatedElement annotatedEle, Predicate<Annotation> filter) {
|
||||
filter = ObjectUtil.defaultIfNull(filter, annotation -> true);
|
||||
for (Annotation annotation : annotatedEle.getAnnotations()) {
|
||||
for (final Annotation annotation : annotatedEle.getAnnotations()) {
|
||||
if (AnnotationUtil.isNotJdkMateAnnotation(annotation.annotationType()) && filter.test(annotation)) {
|
||||
consumer.accept(0, annotation);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class FieldAnnotationScanner implements AnnotationScanner {
|
||||
@Override
|
||||
public void scan(BiConsumer<Integer, Annotation> consumer, AnnotatedElement annotatedEle, Predicate<Annotation> filter) {
|
||||
filter = ObjectUtil.defaultIfNull(filter, annotation -> true);
|
||||
for (Annotation annotation : annotatedEle.getAnnotations()) {
|
||||
for (final Annotation annotation : annotatedEle.getAnnotations()) {
|
||||
if (AnnotationUtil.isNotJdkMateAnnotation(annotation.annotationType()) && filter.test(annotation)) {
|
||||
consumer.accept(0, annotation);
|
||||
}
|
||||
|
@ -67,8 +67,8 @@ public class MetaAnnotationScanner implements AnnotationScanner {
|
||||
public List<Annotation> getAnnotations(AnnotatedElement annotatedEle) {
|
||||
final List<Annotation> annotations = new ArrayList<>();
|
||||
scan(
|
||||
(index, annotation) -> annotations.add(annotation), annotatedEle,
|
||||
annotation -> ObjectUtil.notEqual(annotation, annotatedEle)
|
||||
(index, annotation) -> annotations.add(annotation), annotatedEle,
|
||||
annotation -> ObjectUtil.notEqual(annotation, annotatedEle)
|
||||
);
|
||||
return annotations;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public class MethodAnnotationScanner extends AbstractTypeAnnotationScanner<Metho
|
||||
*/
|
||||
@Override
|
||||
protected Annotation[] getAnnotationsFromTargetClass(AnnotatedElement source, int index, Class<?> targetClass) {
|
||||
Method sourceMethod = (Method) source;
|
||||
final Method sourceMethod = (Method) source;
|
||||
return Stream.of(targetClass.getDeclaredMethods())
|
||||
.filter(superMethod -> !superMethod.isBridge())
|
||||
.filter(superMethod -> hasSameSignature(sourceMethod, superMethod))
|
||||
@ -104,11 +104,11 @@ public class MethodAnnotationScanner extends AbstractTypeAnnotationScanner<Metho
|
||||
* 该方法是否具备与扫描的方法相同的方法签名
|
||||
*/
|
||||
private boolean hasSameSignature(Method sourceMethod, Method superMethod) {
|
||||
if (!StrUtil.equals(sourceMethod.getName(), superMethod.getName())) {
|
||||
if (false == StrUtil.equals(sourceMethod.getName(), superMethod.getName())) {
|
||||
return false;
|
||||
}
|
||||
Class<?>[] sourceParameterTypes = sourceMethod.getParameterTypes();
|
||||
Class<?>[] targetParameterTypes = superMethod.getParameterTypes();
|
||||
final Class<?>[] sourceParameterTypes = sourceMethod.getParameterTypes();
|
||||
final Class<?>[] targetParameterTypes = superMethod.getParameterTypes();
|
||||
if (sourceParameterTypes.length != targetParameterTypes.length) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user