This commit is contained in:
Looly 2023-05-29 00:15:33 +08:00
parent 27d756f26a
commit 33197358f8
44 changed files with 144 additions and 114 deletions

View File

@ -13,7 +13,7 @@
package org.dromara.hutool.core.annotation; package org.dromara.hutool.core.annotation;
import org.dromara.hutool.core.map.SafeConcurrentHashMap; import org.dromara.hutool.core.map.SafeConcurrentHashMap;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.text.CharSequenceUtil; import org.dromara.hutool.core.text.CharSequenceUtil;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;

View File

@ -12,7 +12,7 @@
package org.dromara.hutool.core.annotation; package org.dromara.hutool.core.annotation;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.text.StrUtil; import org.dromara.hutool.core.text.StrUtil;
import java.io.Serializable; import java.io.Serializable;

View File

@ -20,7 +20,7 @@ import org.dromara.hutool.core.func.LambdaUtil;
import org.dromara.hutool.core.func.SerFunction; import org.dromara.hutool.core.func.SerFunction;
import org.dromara.hutool.core.map.WeakConcurrentMap; import org.dromara.hutool.core.map.WeakConcurrentMap;
import org.dromara.hutool.core.reflect.FieldUtil; import org.dromara.hutool.core.reflect.FieldUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.text.CharSequenceUtil; import org.dromara.hutool.core.text.CharSequenceUtil;
import org.dromara.hutool.core.text.StrUtil; import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.ObjUtil; import org.dromara.hutool.core.util.ObjUtil;

View File

@ -13,7 +13,7 @@
package org.dromara.hutool.core.annotation; package org.dromara.hutool.core.annotation;
import org.dromara.hutool.core.reflect.ClassUtil; import org.dromara.hutool.core.reflect.ClassUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.text.CharSequenceUtil; import org.dromara.hutool.core.text.CharSequenceUtil;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;

View File

@ -14,7 +14,7 @@ package org.dromara.hutool.core.annotation;
import org.dromara.hutool.core.collection.CollUtil; import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.reflect.ClassUtil; import org.dromara.hutool.core.reflect.ClassUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.text.CharSequenceUtil; import org.dromara.hutool.core.text.CharSequenceUtil;
import org.dromara.hutool.core.array.ArrayUtil; import org.dromara.hutool.core.array.ArrayUtil;

View File

@ -15,7 +15,7 @@ package org.dromara.hutool.core.annotation;
import org.dromara.hutool.core.array.ArrayUtil; import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.collection.CollUtil; import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.map.WeakConcurrentMap; import org.dromara.hutool.core.map.WeakConcurrentMap;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.text.CharSequenceUtil; import org.dromara.hutool.core.text.CharSequenceUtil;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;

View File

@ -16,7 +16,7 @@ import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.lang.Assert; import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.map.multi.Graph; import org.dromara.hutool.core.map.multi.Graph;
import org.dromara.hutool.core.reflect.ClassUtil; import org.dromara.hutool.core.reflect.ClassUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.text.CharSequenceUtil; import org.dromara.hutool.core.text.CharSequenceUtil;
import org.dromara.hutool.core.array.ArrayUtil; import org.dromara.hutool.core.array.ArrayUtil;

View File

@ -16,7 +16,7 @@ import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.lang.Assert; import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.map.CaseInsensitiveMap; import org.dromara.hutool.core.map.CaseInsensitiveMap;
import org.dromara.hutool.core.reflect.FieldUtil; import org.dromara.hutool.core.reflect.FieldUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.reflect.ModifierUtil; import org.dromara.hutool.core.reflect.ModifierUtil;
import org.dromara.hutool.core.text.StrUtil; import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.BooleanUtil; import org.dromara.hutool.core.util.BooleanUtil;

View File

@ -16,7 +16,7 @@ import org.dromara.hutool.core.exception.CloneException;
import org.dromara.hutool.core.lang.Assert; import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.reflect.ClassUtil; import org.dromara.hutool.core.reflect.ClassUtil;
import org.dromara.hutool.core.reflect.ConstructorUtil; import org.dromara.hutool.core.reflect.ConstructorUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map; import java.util.Map;

View File

@ -17,6 +17,7 @@ import org.dromara.hutool.core.annotation.PropIgnore;
import org.dromara.hutool.core.convert.Convert; import org.dromara.hutool.core.convert.Convert;
import org.dromara.hutool.core.func.LambdaUtil; import org.dromara.hutool.core.func.LambdaUtil;
import org.dromara.hutool.core.reflect.*; import org.dromara.hutool.core.reflect.*;
import org.dromara.hutool.core.reflect.method.MethodUtil;
import java.beans.Transient; import java.beans.Transient;
import java.lang.reflect.Field; import java.lang.reflect.Field;

View File

@ -15,7 +15,7 @@ package org.dromara.hutool.core.bean;
import org.dromara.hutool.core.bean.copier.ValueProvider; import org.dromara.hutool.core.bean.copier.ValueProvider;
import org.dromara.hutool.core.classloader.ClassLoaderUtil; import org.dromara.hutool.core.classloader.ClassLoaderUtil;
import org.dromara.hutool.core.reflect.ConstructorUtil; import org.dromara.hutool.core.reflect.ConstructorUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.util.JdkUtil; import org.dromara.hutool.core.util.JdkUtil;
import java.lang.reflect.Method; import java.lang.reflect.Method;

View File

@ -15,7 +15,7 @@ package org.dromara.hutool.core.classloader;
import org.dromara.hutool.core.exception.HutoolException; import org.dromara.hutool.core.exception.HutoolException;
import org.dromara.hutool.core.io.file.FileUtil; import org.dromara.hutool.core.io.file.FileUtil;
import org.dromara.hutool.core.net.url.URLUtil; import org.dromara.hutool.core.net.url.URLUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;

View File

@ -18,7 +18,7 @@ import org.dromara.hutool.core.collection.ListUtil;
import org.dromara.hutool.core.lang.Assert; import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.map.MapUtil; import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.reflect.FieldUtil; import org.dromara.hutool.core.reflect.FieldUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.text.StrJoiner; import org.dromara.hutool.core.text.StrJoiner;
import org.dromara.hutool.core.text.StrUtil; import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.ObjUtil; import org.dromara.hutool.core.util.ObjUtil;

View File

@ -18,7 +18,7 @@ import org.dromara.hutool.core.lang.EnumItem;
import org.dromara.hutool.core.map.MapUtil; import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.map.WeakConcurrentMap; import org.dromara.hutool.core.map.WeakConcurrentMap;
import org.dromara.hutool.core.reflect.ClassUtil; import org.dromara.hutool.core.reflect.ClassUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.reflect.ModifierUtil; import org.dromara.hutool.core.reflect.ModifierUtil;
import org.dromara.hutool.core.util.EnumUtil; import org.dromara.hutool.core.util.EnumUtil;

View File

@ -18,6 +18,8 @@ import org.dromara.hutool.core.lang.mutable.MutableEntry;
import org.dromara.hutool.core.map.WeakConcurrentMap; import org.dromara.hutool.core.map.WeakConcurrentMap;
import org.dromara.hutool.core.reflect.*; import org.dromara.hutool.core.reflect.*;
import org.dromara.hutool.core.reflect.lookup.LookupUtil; import org.dromara.hutool.core.reflect.lookup.LookupUtil;
import org.dromara.hutool.core.reflect.method.MethodTypeUtil;
import org.dromara.hutool.core.reflect.method.MethodUtil;
import java.lang.invoke.*; import java.lang.invoke.*;
import java.lang.reflect.Executable; import java.lang.reflect.Executable;

View File

@ -19,7 +19,7 @@ import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.lang.Opt; import org.dromara.hutool.core.lang.Opt;
import org.dromara.hutool.core.map.WeakConcurrentMap; import org.dromara.hutool.core.map.WeakConcurrentMap;
import org.dromara.hutool.core.reflect.ClassDescUtil; import org.dromara.hutool.core.reflect.ClassDescUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.reflect.ModifierUtil; import org.dromara.hutool.core.reflect.ModifierUtil;
import java.io.Serializable; import java.io.Serializable;

View File

@ -14,7 +14,7 @@ package org.dromara.hutool.core.io.resource;
import org.dromara.hutool.core.classloader.ClassLoaderUtil; import org.dromara.hutool.core.classloader.ClassLoaderUtil;
import org.dromara.hutool.core.lang.Assert; import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import java.io.InputStream; import java.io.InputStream;
import java.lang.reflect.Method; import java.lang.reflect.Method;

View File

@ -17,6 +17,7 @@ import org.dromara.hutool.core.exception.HutoolException;
import org.dromara.hutool.core.lang.Assert; import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.map.WeakConcurrentMap; import org.dromara.hutool.core.map.WeakConcurrentMap;
import org.dromara.hutool.core.reflect.lookup.LookupUtil; import org.dromara.hutool.core.reflect.lookup.LookupUtil;
import org.dromara.hutool.core.reflect.method.MethodHandleUtil;
import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandle;
import java.lang.reflect.Array; import java.lang.reflect.Array;

View File

@ -12,6 +12,8 @@
package org.dromara.hutool.core.reflect; package org.dromara.hutool.core.reflect;
import org.dromara.hutool.core.reflect.method.MethodUtil;
import java.lang.reflect.*; import java.lang.reflect.*;
/** /**

View File

@ -13,7 +13,7 @@
package org.dromara.hutool.core.reflect.kotlin; package org.dromara.hutool.core.reflect.kotlin;
import org.dromara.hutool.core.classloader.ClassLoaderUtil; import org.dromara.hutool.core.classloader.ClassLoaderUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -14,7 +14,7 @@ package org.dromara.hutool.core.reflect.kotlin;
import org.dromara.hutool.core.classloader.ClassLoaderUtil; import org.dromara.hutool.core.classloader.ClassLoaderUtil;
import org.dromara.hutool.core.reflect.ConstructorUtil; import org.dromara.hutool.core.reflect.ConstructorUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.List; import java.util.List;

View File

@ -13,7 +13,7 @@
package org.dromara.hutool.core.reflect.kotlin; package org.dromara.hutool.core.reflect.kotlin;
import org.dromara.hutool.core.classloader.ClassLoaderUtil; import org.dromara.hutool.core.classloader.ClassLoaderUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Objects; import java.util.Objects;

View File

@ -10,7 +10,7 @@
* See the Mulan PSL v2 for more details. * See the Mulan PSL v2 for more details.
*/ */
package org.dromara.hutool.core.reflect; package org.dromara.hutool.core.reflect.method;
import org.dromara.hutool.core.exception.HutoolException; import org.dromara.hutool.core.exception.HutoolException;
import org.dromara.hutool.core.lang.Assert; import org.dromara.hutool.core.lang.Assert;

View File

@ -10,7 +10,7 @@ import java.util.function.Predicate;
* 若方法符合条件则返回{@link Boolean#TRUE}否则返回{@code null} * 若方法符合条件则返回{@link Boolean#TRUE}否则返回{@code null}
* *
* @author huangchengxing * @author huangchengxing
* @see MethodMatcherUtils * @see MethodMatcherUtil
* @see MethodMetadataLookup * @see MethodMetadataLookup
* @since 6.0.0 * @since 6.0.0
*/ */

View File

@ -23,7 +23,7 @@ import java.util.stream.Stream;
* @see MethodMatcher * @see MethodMatcher
* @since 6.0.0 * @since 6.0.0
*/ */
public class MethodMatcherUtils { public class MethodMatcherUtil {
/** /**

View File

@ -7,7 +7,7 @@ import java.lang.reflect.Method;
* *
* @author huangchengxing * @author huangchengxing
* @see MethodMatcher * @see MethodMatcher
* @see MethodMatcherUtils * @see MethodMatcherUtil
* @since 6.0.0 * @since 6.0.0
*/ */
@FunctionalInterface @FunctionalInterface

View File

@ -6,7 +6,6 @@ import org.dromara.hutool.core.lang.mutable.MutableObj;
import org.dromara.hutool.core.map.MapUtil; import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.map.WeakConcurrentMap; import org.dromara.hutool.core.map.WeakConcurrentMap;
import org.dromara.hutool.core.reflect.ClassUtil; import org.dromara.hutool.core.reflect.ClassUtil;
import org.dromara.hutool.core.reflect.MethodUtil;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.*; import java.util.*;
@ -41,7 +40,7 @@ import java.util.function.Predicate;
* <pre>{@code * <pre>{@code
* Map<Method, Annotation> methods = MethodScanner.findFromAllMethods(Foo.class, method -> method.getAnnotation(Annotation.class)); * Map<Method, Annotation> methods = MethodScanner.findFromAllMethods(Foo.class, method -> method.getAnnotation(Annotation.class));
* }</pre> * }</pre>
* 此外对于一些无需获取元数据的查找我们可以使用{@link MethodMatcherUtils}提供的一些内置实现 * 此外对于一些无需获取元数据的查找我们可以使用{@link MethodMatcherUtil}提供的一些内置实现
* <pre>{@code * <pre>{@code
* // 查找所有静态公开方法 * // 查找所有静态公开方法
* Set<Method> methods = MethodScanner.findFromAllMethods(Foo.class, MethodMatcherUtils.isPublicStatic()); * Set<Method> methods = MethodScanner.findFromAllMethods(Foo.class, MethodMatcherUtils.isPublicStatic());
@ -60,7 +59,7 @@ import java.util.function.Predicate;
* @author huangchengxing * @author huangchengxing
* @see MethodMetadataLookup * @see MethodMetadataLookup
* @see MethodMatcher * @see MethodMatcher
* @see MethodMatcherUtils * @see MethodMatcherUtil
* @since 6.0.0 * @since 6.0.0
*/ */
public class MethodScanner { public class MethodScanner {

View File

@ -10,7 +10,7 @@
* See the Mulan PSL v2 for more details. * See the Mulan PSL v2 for more details.
*/ */
package org.dromara.hutool.core.reflect; package org.dromara.hutool.core.reflect.method;
import java.lang.invoke.MethodType; import java.lang.invoke.MethodType;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;

View File

@ -10,7 +10,7 @@
* See the Mulan PSL v2 for more details. * See the Mulan PSL v2 for more details.
*/ */
package org.dromara.hutool.core.reflect; package org.dromara.hutool.core.reflect.method;
import org.dromara.hutool.core.array.ArrayUtil; import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.bean.NullWrapperBean; import org.dromara.hutool.core.bean.NullWrapperBean;
@ -22,6 +22,9 @@ import org.dromara.hutool.core.exception.HutoolException;
import org.dromara.hutool.core.lang.Assert; import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.lang.Singleton; import org.dromara.hutool.core.lang.Singleton;
import org.dromara.hutool.core.map.WeakConcurrentMap; import org.dromara.hutool.core.map.WeakConcurrentMap;
import org.dromara.hutool.core.reflect.ClassUtil;
import org.dromara.hutool.core.reflect.ConstructorUtil;
import org.dromara.hutool.core.reflect.ModifierUtil;
import org.dromara.hutool.core.text.StrUtil; import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.BooleanUtil; import org.dromara.hutool.core.util.BooleanUtil;

View File

@ -0,0 +1,19 @@
/*
* Copyright (c) 2023 looly(loolly@aliyun.com)
* Hutool is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* 提供方法相关封装
*
* @author huangchengxing, looly
* @since 6.0.0
*/
package org.dromara.hutool.core.reflect.method;

View File

@ -23,7 +23,7 @@ import org.dromara.hutool.core.lang.Validator;
import org.dromara.hutool.core.lang.mutable.Mutable; import org.dromara.hutool.core.lang.mutable.Mutable;
import org.dromara.hutool.core.lang.mutable.MutableObj; import org.dromara.hutool.core.lang.mutable.MutableObj;
import org.dromara.hutool.core.map.MapUtil; import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.text.StrUtil; import org.dromara.hutool.core.text.StrUtil;
import java.util.*; import java.util.*;

View File

@ -21,7 +21,7 @@ import org.dromara.hutool.core.io.SerializeUtil;
import org.dromara.hutool.core.map.MapUtil; import org.dromara.hutool.core.map.MapUtil;
import org.dromara.hutool.core.math.NumberUtil; import org.dromara.hutool.core.math.NumberUtil;
import org.dromara.hutool.core.reflect.ClassUtil; import org.dromara.hutool.core.reflect.ClassUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.text.CharSequenceUtil; import org.dromara.hutool.core.text.CharSequenceUtil;
import org.dromara.hutool.core.text.StrUtil; import org.dromara.hutool.core.text.StrUtil;

View File

@ -17,7 +17,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.FieldNameConstants; import lombok.experimental.FieldNameConstants;
import org.dromara.hutool.core.lang.tuple.Tuple; import org.dromara.hutool.core.lang.tuple.Tuple;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledForJreRange; import org.junit.jupiter.api.condition.EnabledForJreRange;

View File

@ -1,6 +1,8 @@
package org.dromara.hutool.core.reflect; package org.dromara.hutool.core.reflect;
import org.dromara.hutool.core.classloader.ClassLoaderUtil; import org.dromara.hutool.core.classloader.ClassLoaderUtil;
import org.dromara.hutool.core.reflect.method.MethodHandleUtil;
import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View File

@ -5,6 +5,7 @@ import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.date.StopWatch; import org.dromara.hutool.core.date.StopWatch;
import org.dromara.hutool.core.lang.Console; import org.dromara.hutool.core.lang.Console;
import org.dromara.hutool.core.lang.test.bean.ExamInfoDict; import org.dromara.hutool.core.lang.test.bean.ExamInfoDict;
import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.text.StrUtil; import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.JdkUtil; import org.dromara.hutool.core.util.JdkUtil;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;

View File

@ -12,7 +12,7 @@
package org.dromara.hutool.core.reflect.lookup; package org.dromara.hutool.core.reflect.lookup;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;

View File

@ -19,7 +19,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
/** /**
* test for {@link MethodMatcherUtils} * test for {@link MethodMatcherUtil}
* *
* @author huangchengxing * @author huangchengxing
*/ */
@ -47,25 +47,25 @@ class MethodMatcherUtilsTest {
@Test @Test
void testForName() { void testForName() {
MethodMatcher methodMatcher = MethodMatcherUtils.forName("noneReturnNoArgs"); MethodMatcher methodMatcher = MethodMatcherUtil.forName("noneReturnNoArgs");
Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
} }
@Test @Test
void forNameIgnoreCase() { void forNameIgnoreCase() {
MethodMatcher methodMatcher = MethodMatcherUtils.forNameIgnoreCase("noneReturnNoArgs"); MethodMatcher methodMatcher = MethodMatcherUtil.forNameIgnoreCase("noneReturnNoArgs");
Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
// if name is upper case, it will be ignored // if name is upper case, it will be ignored
methodMatcher = MethodMatcherUtils.forNameIgnoreCase("NONERETURNNOARGS"); methodMatcher = MethodMatcherUtil.forNameIgnoreCase("NONERETURNNOARGS");
Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
} }
@Test @Test
void forNoneReturnType() { void forNoneReturnType() {
MethodMatcher methodMatcher = MethodMatcherUtils.forNoneReturnType(); MethodMatcher methodMatcher = MethodMatcherUtil.forNoneReturnType();
Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnOneArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnOneArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
@ -76,7 +76,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void forReturnType() { void forReturnType() {
MethodMatcher methodMatcher = MethodMatcherUtils.forReturnType(Collection.class); MethodMatcher methodMatcher = MethodMatcherUtil.forReturnType(Collection.class);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs));
@ -87,7 +87,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void forStrictReturnType() { void forStrictReturnType() {
MethodMatcher methodMatcher = MethodMatcherUtils.forStrictReturnType(Collection.class); MethodMatcher methodMatcher = MethodMatcherUtil.forStrictReturnType(Collection.class);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs));
@ -95,7 +95,7 @@ class MethodMatcherUtilsTest {
Assertions.assertFalse(methodMatcher.test(returnOneArgs)); Assertions.assertFalse(methodMatcher.test(returnOneArgs));
Assertions.assertFalse(methodMatcher.test(returnTwoArgs)); Assertions.assertFalse(methodMatcher.test(returnTwoArgs));
// only match return type is strict equal to parameter type // only match return type is strict equal to parameter type
methodMatcher = MethodMatcherUtils.forStrictReturnType(List.class); methodMatcher = MethodMatcherUtil.forStrictReturnType(List.class);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs));
@ -106,7 +106,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void forParameterCount() { void forParameterCount() {
MethodMatcher methodMatcher = MethodMatcherUtils.forParameterCount(2); MethodMatcher methodMatcher = MethodMatcherUtil.forParameterCount(2);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
@ -115,30 +115,30 @@ class MethodMatcherUtilsTest {
@Test @Test
void forMostSpecificParameterTypes() { void forMostSpecificParameterTypes() {
// match none args method // match none args method
MethodMatcher methodMatcher = MethodMatcherUtils.forMostSpecificParameterTypes(); MethodMatcher methodMatcher = MethodMatcherUtil.forMostSpecificParameterTypes();
Assertions.assertFalse(methodMatcher.test(returnTwoArgs)); Assertions.assertFalse(methodMatcher.test(returnTwoArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs));
// match all args types // match all args types
methodMatcher = MethodMatcherUtils.forMostSpecificParameterTypes(null, null); methodMatcher = MethodMatcherUtil.forMostSpecificParameterTypes(null, null);
Assertions.assertTrue(methodMatcher.test(returnTwoArgs)); Assertions.assertTrue(methodMatcher.test(returnTwoArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
// match first arg type // match first arg type
methodMatcher = MethodMatcherUtils.forMostSpecificParameterTypes(CharSequence.class, null); methodMatcher = MethodMatcherUtil.forMostSpecificParameterTypes(CharSequence.class, null);
Assertions.assertTrue(methodMatcher.test(returnTwoArgs)); Assertions.assertTrue(methodMatcher.test(returnTwoArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
Assertions.assertFalse(methodMatcher.test(returnOneArgs)); Assertions.assertFalse(methodMatcher.test(returnOneArgs));
// match second arg type // match second arg type
methodMatcher = MethodMatcherUtils.forMostSpecificParameterTypes(null, Collection.class); methodMatcher = MethodMatcherUtil.forMostSpecificParameterTypes(null, Collection.class);
Assertions.assertTrue(methodMatcher.test(returnTwoArgs)); Assertions.assertTrue(methodMatcher.test(returnTwoArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
Assertions.assertFalse(methodMatcher.test(returnOneArgs)); Assertions.assertFalse(methodMatcher.test(returnOneArgs));
// match two arg type // match two arg type
methodMatcher = MethodMatcherUtils.forMostSpecificParameterTypes(CharSequence.class, Collection.class); methodMatcher = MethodMatcherUtil.forMostSpecificParameterTypes(CharSequence.class, Collection.class);
Assertions.assertTrue(methodMatcher.test(returnTwoArgs)); Assertions.assertTrue(methodMatcher.test(returnTwoArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
Assertions.assertFalse(methodMatcher.test(returnOneArgs)); Assertions.assertFalse(methodMatcher.test(returnOneArgs));
@ -147,34 +147,34 @@ class MethodMatcherUtilsTest {
@Test @Test
void forMostSpecificStrictParameterTypes() { void forMostSpecificStrictParameterTypes() {
// match none args method // match none args method
MethodMatcher methodMatcher = MethodMatcherUtils.forMostSpecificStrictParameterTypes(); MethodMatcher methodMatcher = MethodMatcherUtil.forMostSpecificStrictParameterTypes();
Assertions.assertFalse(methodMatcher.test(returnTwoArgs)); Assertions.assertFalse(methodMatcher.test(returnTwoArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs));
// match all args types // match all args types
methodMatcher = MethodMatcherUtils.forMostSpecificStrictParameterTypes(null, null); methodMatcher = MethodMatcherUtil.forMostSpecificStrictParameterTypes(null, null);
Assertions.assertTrue(methodMatcher.test(returnTwoArgs)); Assertions.assertTrue(methodMatcher.test(returnTwoArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
// match first arg type // match first arg type
methodMatcher = MethodMatcherUtils.forMostSpecificStrictParameterTypes(CharSequence.class, null); methodMatcher = MethodMatcherUtil.forMostSpecificStrictParameterTypes(CharSequence.class, null);
Assertions.assertFalse(methodMatcher.test(returnTwoArgs)); Assertions.assertFalse(methodMatcher.test(returnTwoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs));
Assertions.assertFalse(methodMatcher.test(returnOneArgs)); Assertions.assertFalse(methodMatcher.test(returnOneArgs));
methodMatcher = MethodMatcherUtils.forMostSpecificStrictParameterTypes(String.class, null); methodMatcher = MethodMatcherUtil.forMostSpecificStrictParameterTypes(String.class, null);
Assertions.assertTrue(methodMatcher.test(returnTwoArgs)); Assertions.assertTrue(methodMatcher.test(returnTwoArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
Assertions.assertFalse(methodMatcher.test(returnOneArgs)); Assertions.assertFalse(methodMatcher.test(returnOneArgs));
// match second arg type // match second arg type
methodMatcher = MethodMatcherUtils.forMostSpecificStrictParameterTypes(null, Collection.class); methodMatcher = MethodMatcherUtil.forMostSpecificStrictParameterTypes(null, Collection.class);
Assertions.assertFalse(methodMatcher.test(returnTwoArgs)); Assertions.assertFalse(methodMatcher.test(returnTwoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs));
Assertions.assertFalse(methodMatcher.test(returnOneArgs)); Assertions.assertFalse(methodMatcher.test(returnOneArgs));
// match two arg type // match two arg type
methodMatcher = MethodMatcherUtils.forMostSpecificStrictParameterTypes(CharSequence.class, Collection.class); methodMatcher = MethodMatcherUtil.forMostSpecificStrictParameterTypes(CharSequence.class, Collection.class);
Assertions.assertFalse(methodMatcher.test(returnTwoArgs)); Assertions.assertFalse(methodMatcher.test(returnTwoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs));
Assertions.assertFalse(methodMatcher.test(returnOneArgs)); Assertions.assertFalse(methodMatcher.test(returnOneArgs));
@ -182,7 +182,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void forParameterTypes() { void forParameterTypes() {
MethodMatcher methodMatcher = MethodMatcherUtils.forParameterTypes(); MethodMatcher methodMatcher = MethodMatcherUtil.forParameterTypes();
Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs));
@ -190,7 +190,7 @@ class MethodMatcherUtilsTest {
Assertions.assertFalse(methodMatcher.test(returnOneArgs)); Assertions.assertFalse(methodMatcher.test(returnOneArgs));
Assertions.assertFalse(methodMatcher.test(returnTwoArgs)); Assertions.assertFalse(methodMatcher.test(returnTwoArgs));
// match parameter types is empty // match parameter types is empty
methodMatcher = MethodMatcherUtils.forParameterTypes(CharSequence.class, Collection.class); methodMatcher = MethodMatcherUtil.forParameterTypes(CharSequence.class, Collection.class);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
@ -201,7 +201,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void forStrictParameterTypes() { void forStrictParameterTypes() {
MethodMatcher methodMatcher = MethodMatcherUtils.forStrictParameterTypes(); MethodMatcher methodMatcher = MethodMatcherUtil.forStrictParameterTypes();
Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs));
@ -210,7 +210,7 @@ class MethodMatcherUtilsTest {
Assertions.assertFalse(methodMatcher.test(returnTwoArgs)); Assertions.assertFalse(methodMatcher.test(returnTwoArgs));
// cannot match assignable parameter types // cannot match assignable parameter types
methodMatcher = MethodMatcherUtils.forStrictParameterTypes(CharSequence.class, Collection.class); methodMatcher = MethodMatcherUtil.forStrictParameterTypes(CharSequence.class, Collection.class);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs));
@ -219,7 +219,7 @@ class MethodMatcherUtilsTest {
Assertions.assertFalse(methodMatcher.test(returnTwoArgs)); Assertions.assertFalse(methodMatcher.test(returnTwoArgs));
// only match parameter types is strict equal to parameter type // only match parameter types is strict equal to parameter type
methodMatcher = MethodMatcherUtils.forStrictParameterTypes(String.class, List.class); methodMatcher = MethodMatcherUtil.forStrictParameterTypes(String.class, List.class);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
@ -230,7 +230,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void noneMatch() { void noneMatch() {
MethodMatcher methodMatcher = MethodMatcherUtils.noneMatch(); MethodMatcher methodMatcher = MethodMatcherUtil.noneMatch();
Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnOneArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnOneArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
@ -239,9 +239,9 @@ class MethodMatcherUtilsTest {
Assertions.assertTrue(methodMatcher.test(returnTwoArgs)); Assertions.assertTrue(methodMatcher.test(returnTwoArgs));
// combine with other matchers // combine with other matchers
methodMatcher = MethodMatcherUtils.noneMatch( methodMatcher = MethodMatcherUtil.noneMatch(
MethodMatcherUtils.forName("noneReturnNoArgs"), MethodMatcherUtil.forName("noneReturnNoArgs"),
MethodMatcherUtils.forReturnType(Collection.class) MethodMatcherUtil.forReturnType(Collection.class)
); );
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnOneArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnOneArgs));
@ -249,7 +249,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void anyMatch() { void anyMatch() {
MethodMatcher methodMatcher = MethodMatcherUtils.anyMatch(); MethodMatcher methodMatcher = MethodMatcherUtil.anyMatch();
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs));
@ -258,9 +258,9 @@ class MethodMatcherUtilsTest {
Assertions.assertFalse(methodMatcher.test(returnTwoArgs)); Assertions.assertFalse(methodMatcher.test(returnTwoArgs));
// combine with other matchers // combine with other matchers
methodMatcher = MethodMatcherUtils.anyMatch( methodMatcher = MethodMatcherUtil.anyMatch(
MethodMatcherUtils.forName("noneReturnNoArgs"), MethodMatcherUtil.forName("noneReturnNoArgs"),
MethodMatcherUtils.forReturnType(Collection.class) MethodMatcherUtil.forReturnType(Collection.class)
); );
Assertions.assertTrue(methodMatcher.test(returnNoArgs)); Assertions.assertTrue(methodMatcher.test(returnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
@ -269,7 +269,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void allMatch() { void allMatch() {
MethodMatcher methodMatcher = MethodMatcherUtils.allMatch(); MethodMatcher methodMatcher = MethodMatcherUtil.allMatch();
Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnNoArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnOneArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnOneArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
@ -278,9 +278,9 @@ class MethodMatcherUtilsTest {
Assertions.assertTrue(methodMatcher.test(returnTwoArgs)); Assertions.assertTrue(methodMatcher.test(returnTwoArgs));
// combine with other matchers // combine with other matchers
methodMatcher = MethodMatcherUtils.allMatch( methodMatcher = MethodMatcherUtil.allMatch(
MethodMatcherUtils.forName("noneReturnNoArgs"), MethodMatcherUtil.forName("noneReturnNoArgs"),
MethodMatcherUtils.forReturnType(Collection.class) MethodMatcherUtil.forReturnType(Collection.class)
); );
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
@ -292,7 +292,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void isPublic() { void isPublic() {
MethodMatcher methodMatcher = MethodMatcherUtils.isPublic(); MethodMatcher methodMatcher = MethodMatcherUtil.isPublic();
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
@ -303,7 +303,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void isStatic() { void isStatic() {
MethodMatcher methodMatcher = MethodMatcherUtils.isStatic(); MethodMatcher methodMatcher = MethodMatcherUtil.isStatic();
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnOneArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnOneArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
@ -314,7 +314,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void isPublicStatic() { void isPublicStatic() {
MethodMatcher methodMatcher = MethodMatcherUtils.isPublicStatic(); MethodMatcher methodMatcher = MethodMatcherUtil.isPublicStatic();
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
@ -325,7 +325,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void forModifiers() { void forModifiers() {
MethodMatcher methodMatcher = MethodMatcherUtils.forModifiers(Modifier.PUBLIC, Modifier.STATIC); MethodMatcher methodMatcher = MethodMatcherUtil.forModifiers(Modifier.PUBLIC, Modifier.STATIC);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
@ -336,7 +336,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void forNameAndParameterTypes() { void forNameAndParameterTypes() {
MethodMatcher methodMatcher = MethodMatcherUtils.forNameAndParameterTypes("noneReturnTwoArgs", CharSequence.class, List.class); MethodMatcher methodMatcher = MethodMatcherUtil.forNameAndParameterTypes("noneReturnTwoArgs", CharSequence.class, List.class);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
@ -347,7 +347,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void forNameAndStrictParameterTypes() { void forNameAndStrictParameterTypes() {
MethodMatcher methodMatcher = MethodMatcherUtils.forNameAndStrictParameterTypes("noneReturnTwoArgs", CharSequence.class, List.class); MethodMatcher methodMatcher = MethodMatcherUtil.forNameAndStrictParameterTypes("noneReturnTwoArgs", CharSequence.class, List.class);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs));
@ -355,7 +355,7 @@ class MethodMatcherUtilsTest {
Assertions.assertFalse(methodMatcher.test(returnOneArgs)); Assertions.assertFalse(methodMatcher.test(returnOneArgs));
Assertions.assertFalse(methodMatcher.test(returnTwoArgs)); Assertions.assertFalse(methodMatcher.test(returnTwoArgs));
methodMatcher = MethodMatcherUtils.forNameAndStrictParameterTypes("returnTwoArgs", String.class, List.class); methodMatcher = MethodMatcherUtil.forNameAndStrictParameterTypes("returnTwoArgs", String.class, List.class);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs));
@ -366,7 +366,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void forNameIgnoreCaseAndParameterTypes() { void forNameIgnoreCaseAndParameterTypes() {
MethodMatcher methodMatcher = MethodMatcherUtils.forNameIgnoreCaseAndParameterTypes("NONEReturnTWOArgs", CharSequence.class, List.class); MethodMatcher methodMatcher = MethodMatcherUtil.forNameIgnoreCaseAndParameterTypes("NONEReturnTWOArgs", CharSequence.class, List.class);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
@ -374,7 +374,7 @@ class MethodMatcherUtilsTest {
Assertions.assertFalse(methodMatcher.test(returnOneArgs)); Assertions.assertFalse(methodMatcher.test(returnOneArgs));
Assertions.assertFalse(methodMatcher.test(returnTwoArgs)); Assertions.assertFalse(methodMatcher.test(returnTwoArgs));
methodMatcher = MethodMatcherUtils.forNameIgnoreCaseAndParameterTypes("ReturnTWOArgs", String.class, List.class); methodMatcher = MethodMatcherUtil.forNameIgnoreCaseAndParameterTypes("ReturnTWOArgs", String.class, List.class);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
@ -385,7 +385,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void forNameIgnoreCaseAndStrictParameterTypes() { void forNameIgnoreCaseAndStrictParameterTypes() {
MethodMatcher methodMatcher = MethodMatcherUtils.forNameIgnoreCaseAndStrictParameterTypes("NONEReturnTWOArgs", CharSequence.class, List.class); MethodMatcher methodMatcher = MethodMatcherUtil.forNameIgnoreCaseAndStrictParameterTypes("NONEReturnTWOArgs", CharSequence.class, List.class);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs));
@ -393,7 +393,7 @@ class MethodMatcherUtilsTest {
Assertions.assertFalse(methodMatcher.test(returnOneArgs)); Assertions.assertFalse(methodMatcher.test(returnOneArgs));
Assertions.assertFalse(methodMatcher.test(returnTwoArgs)); Assertions.assertFalse(methodMatcher.test(returnTwoArgs));
methodMatcher = MethodMatcherUtils.forNameIgnoreCaseAndStrictParameterTypes("ReturnTWOArgs", String.class, List.class); methodMatcher = MethodMatcherUtil.forNameIgnoreCaseAndStrictParameterTypes("ReturnTWOArgs", String.class, List.class);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
@ -404,7 +404,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void forStrictMethodSignature() { void forStrictMethodSignature() {
MethodMatcher methodMatcher = MethodMatcherUtils.forStrictMethodSignature("noneReturnTwoArgs", null, CharSequence.class, Collection.class); MethodMatcher methodMatcher = MethodMatcherUtil.forStrictMethodSignature("noneReturnTwoArgs", null, CharSequence.class, Collection.class);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs2)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs2));
@ -412,7 +412,7 @@ class MethodMatcherUtilsTest {
Assertions.assertFalse(methodMatcher.test(returnOneArgs)); Assertions.assertFalse(methodMatcher.test(returnOneArgs));
Assertions.assertFalse(methodMatcher.test(returnTwoArgs)); Assertions.assertFalse(methodMatcher.test(returnTwoArgs));
methodMatcher = MethodMatcherUtils.forStrictMethodSignature("noneReturnTwoArgs", null, String.class, List.class); methodMatcher = MethodMatcherUtil.forStrictMethodSignature("noneReturnTwoArgs", null, String.class, List.class);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs2)); Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs2));
@ -423,7 +423,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void forStrictMethodSignatureWithMethod() { void forStrictMethodSignatureWithMethod() {
MethodMatcher methodMatcher = MethodMatcherUtils.forStrictMethodSignature(noneReturnTwoArgs); MethodMatcher methodMatcher = MethodMatcherUtil.forStrictMethodSignature(noneReturnTwoArgs);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
@ -431,7 +431,7 @@ class MethodMatcherUtilsTest {
Assertions.assertFalse(methodMatcher.test(returnOneArgs)); Assertions.assertFalse(methodMatcher.test(returnOneArgs));
Assertions.assertFalse(methodMatcher.test(returnTwoArgs)); Assertions.assertFalse(methodMatcher.test(returnTwoArgs));
methodMatcher = MethodMatcherUtils.forStrictMethodSignature(returnTwoArgs); methodMatcher = MethodMatcherUtil.forStrictMethodSignature(returnTwoArgs);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnTwoArgs));
@ -442,7 +442,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void forMethodSignatureWithMethod() { void forMethodSignatureWithMethod() {
MethodMatcher methodMatcher = MethodMatcherUtils.forMethodSignature(noneReturnTwoArgs2); MethodMatcher methodMatcher = MethodMatcherUtil.forMethodSignature(noneReturnTwoArgs2);
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnOneArgs));
Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs)); Assertions.assertTrue(methodMatcher.test(noneReturnTwoArgs));
@ -454,7 +454,7 @@ class MethodMatcherUtilsTest {
@Test @Test
void forMethodSignature() { void forMethodSignature() {
MethodMatcher methodMatcher = MethodMatcherUtils.forMethodSignature( MethodMatcher methodMatcher = MethodMatcherUtil.forMethodSignature(
"noneReturnTwoArgs", null, CharSequence.class, Collection.class "noneReturnTwoArgs", null, CharSequence.class, Collection.class
); );
Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs)); Assertions.assertFalse(methodMatcher.test(noneReturnNoArgs));
@ -470,17 +470,17 @@ class MethodMatcherUtilsTest {
@SneakyThrows @SneakyThrows
void forGetterMethodWithField() { void forGetterMethodWithField() {
Field nameField = Foo.class.getDeclaredField("name"); Field nameField = Foo.class.getDeclaredField("name");
MethodMatcher methodMatcher = MethodMatcherUtils.forGetterMethod(nameField); MethodMatcher methodMatcher = MethodMatcherUtil.forGetterMethod(nameField);
Method getName = Foo.class.getMethod("getName"); Method getName = Foo.class.getMethod("getName");
Assertions.assertTrue(methodMatcher.test(getName)); Assertions.assertTrue(methodMatcher.test(getName));
Field flagField = Foo.class.getDeclaredField("flag"); Field flagField = Foo.class.getDeclaredField("flag");
methodMatcher = MethodMatcherUtils.forGetterMethod(flagField); methodMatcher = MethodMatcherUtil.forGetterMethod(flagField);
Method isFlag = Foo.class.getMethod("isFlag"); Method isFlag = Foo.class.getMethod("isFlag");
Assertions.assertTrue(methodMatcher.test(isFlag)); Assertions.assertTrue(methodMatcher.test(isFlag));
Field objectField = Foo.class.getDeclaredField("object"); Field objectField = Foo.class.getDeclaredField("object");
methodMatcher = MethodMatcherUtils.forGetterMethod(objectField); methodMatcher = MethodMatcherUtil.forGetterMethod(objectField);
Method object = Foo.class.getMethod("object"); Method object = Foo.class.getMethod("object");
Assertions.assertTrue(methodMatcher.test(object)); Assertions.assertTrue(methodMatcher.test(object));
} }
@ -488,15 +488,15 @@ class MethodMatcherUtilsTest {
@Test @Test
@SneakyThrows @SneakyThrows
void forGetterMethod() { void forGetterMethod() {
MethodMatcher methodMatcher = MethodMatcherUtils.forGetterMethod("name", String.class); MethodMatcher methodMatcher = MethodMatcherUtil.forGetterMethod("name", String.class);
Method getName = Foo.class.getMethod("getName"); Method getName = Foo.class.getMethod("getName");
Assertions.assertTrue(methodMatcher.test(getName)); Assertions.assertTrue(methodMatcher.test(getName));
methodMatcher = MethodMatcherUtils.forGetterMethod("flag", boolean.class); methodMatcher = MethodMatcherUtil.forGetterMethod("flag", boolean.class);
Method isFlag = Foo.class.getMethod("isFlag"); Method isFlag = Foo.class.getMethod("isFlag");
Assertions.assertTrue(methodMatcher.test(isFlag)); Assertions.assertTrue(methodMatcher.test(isFlag));
methodMatcher = MethodMatcherUtils.forGetterMethod("object", Object.class); methodMatcher = MethodMatcherUtil.forGetterMethod("object", Object.class);
Method object = Foo.class.getMethod("object"); Method object = Foo.class.getMethod("object");
Assertions.assertTrue(methodMatcher.test(object)); Assertions.assertTrue(methodMatcher.test(object));
} }
@ -505,17 +505,17 @@ class MethodMatcherUtilsTest {
@SneakyThrows @SneakyThrows
void forSetterMethodWithField() { void forSetterMethodWithField() {
Field nameField = Foo.class.getDeclaredField("name"); Field nameField = Foo.class.getDeclaredField("name");
MethodMatcher methodMatcher = MethodMatcherUtils.forSetterMethod(nameField); MethodMatcher methodMatcher = MethodMatcherUtil.forSetterMethod(nameField);
Method setName = Foo.class.getMethod("setName", String.class); Method setName = Foo.class.getMethod("setName", String.class);
Assertions.assertTrue(methodMatcher.test(setName)); Assertions.assertTrue(methodMatcher.test(setName));
Field flagField = Foo.class.getDeclaredField("flag"); Field flagField = Foo.class.getDeclaredField("flag");
methodMatcher = MethodMatcherUtils.forSetterMethod(flagField); methodMatcher = MethodMatcherUtil.forSetterMethod(flagField);
Method setFlag = Foo.class.getMethod("setFlag", boolean.class); Method setFlag = Foo.class.getMethod("setFlag", boolean.class);
Assertions.assertTrue(methodMatcher.test(setFlag)); Assertions.assertTrue(methodMatcher.test(setFlag));
Field objectField = Foo.class.getDeclaredField("object"); Field objectField = Foo.class.getDeclaredField("object");
methodMatcher = MethodMatcherUtils.forSetterMethod(objectField); methodMatcher = MethodMatcherUtil.forSetterMethod(objectField);
Method object = Foo.class.getMethod("object", Object.class); Method object = Foo.class.getMethod("object", Object.class);
Assertions.assertTrue(methodMatcher.test(object)); Assertions.assertTrue(methodMatcher.test(object));
} }
@ -523,15 +523,15 @@ class MethodMatcherUtilsTest {
@Test @Test
@SneakyThrows @SneakyThrows
void forSetterMethod() { void forSetterMethod() {
MethodMatcher methodMatcher = MethodMatcherUtils.forSetterMethod("name", String.class); MethodMatcher methodMatcher = MethodMatcherUtil.forSetterMethod("name", String.class);
Method setName = Foo.class.getMethod("setName", String.class); Method setName = Foo.class.getMethod("setName", String.class);
Assertions.assertTrue(methodMatcher.test(setName)); Assertions.assertTrue(methodMatcher.test(setName));
methodMatcher = MethodMatcherUtils.forSetterMethod("flag", boolean.class); methodMatcher = MethodMatcherUtil.forSetterMethod("flag", boolean.class);
Method setFlag = Foo.class.getMethod("setFlag", boolean.class); Method setFlag = Foo.class.getMethod("setFlag", boolean.class);
Assertions.assertTrue(methodMatcher.test(setFlag)); Assertions.assertTrue(methodMatcher.test(setFlag));
methodMatcher = MethodMatcherUtils.forSetterMethod("object", Object.class); methodMatcher = MethodMatcherUtil.forSetterMethod("object", Object.class);
Method object = Foo.class.getMethod("object", Object.class); Method object = Foo.class.getMethod("object", Object.class);
Assertions.assertTrue(methodMatcher.test(object)); Assertions.assertTrue(methodMatcher.test(object));
} }
@ -539,7 +539,7 @@ class MethodMatcherUtilsTest {
@Test @Test
@SneakyThrows @SneakyThrows
void hasDeclaredAnnotation() { void hasDeclaredAnnotation() {
MethodMatcher methodMatcher = MethodMatcherUtils.hasDeclaredAnnotation(GrandParentAnnotation.class); MethodMatcher methodMatcher = MethodMatcherUtil.hasDeclaredAnnotation(GrandParentAnnotation.class);
Assertions.assertFalse(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByChildAnnotation"))); Assertions.assertFalse(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByChildAnnotation")));
Assertions.assertFalse(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByParentAnnotation"))); Assertions.assertFalse(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByParentAnnotation")));
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByGrandParentAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByGrandParentAnnotation")));
@ -549,13 +549,13 @@ class MethodMatcherUtilsTest {
@Test @Test
@SneakyThrows @SneakyThrows
void hasAnnotation() { void hasAnnotation() {
MethodMatcher methodMatcher = MethodMatcherUtils.hasAnnotation(GrandParentAnnotation.class); MethodMatcher methodMatcher = MethodMatcherUtil.hasAnnotation(GrandParentAnnotation.class);
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByChildAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByChildAnnotation")));
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByParentAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByParentAnnotation")));
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByGrandParentAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByGrandParentAnnotation")));
Assertions.assertFalse(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("noneAnnotated"))); Assertions.assertFalse(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("noneAnnotated")));
methodMatcher = MethodMatcherUtils.hasAnnotation(ParentAnnotation.class); methodMatcher = MethodMatcherUtil.hasAnnotation(ParentAnnotation.class);
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByChildAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByChildAnnotation")));
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByParentAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByParentAnnotation")));
Assertions.assertFalse(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByGrandParentAnnotation"))); Assertions.assertFalse(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByGrandParentAnnotation")));
@ -565,19 +565,19 @@ class MethodMatcherUtilsTest {
@Test @Test
@SneakyThrows @SneakyThrows
void hasAnnotationOnDeclaringClass() { void hasAnnotationOnDeclaringClass() {
MethodMatcher methodMatcher = MethodMatcherUtils.hasAnnotationOnDeclaringClass(GrandParentAnnotation.class); MethodMatcher methodMatcher = MethodMatcherUtil.hasAnnotationOnDeclaringClass(GrandParentAnnotation.class);
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByChildAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByChildAnnotation")));
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByParentAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByParentAnnotation")));
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByGrandParentAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByGrandParentAnnotation")));
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("noneAnnotated"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("noneAnnotated")));
methodMatcher = MethodMatcherUtils.hasAnnotationOnDeclaringClass(ParentAnnotation.class); methodMatcher = MethodMatcherUtil.hasAnnotationOnDeclaringClass(ParentAnnotation.class);
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByChildAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByChildAnnotation")));
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByParentAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByParentAnnotation")));
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByGrandParentAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByGrandParentAnnotation")));
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("noneAnnotated"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("noneAnnotated")));
methodMatcher = MethodMatcherUtils.hasAnnotationOnDeclaringClass(ChildAnnotation.class); methodMatcher = MethodMatcherUtil.hasAnnotationOnDeclaringClass(ChildAnnotation.class);
Assertions.assertFalse(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByChildAnnotation"))); Assertions.assertFalse(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByChildAnnotation")));
Assertions.assertFalse(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByParentAnnotation"))); Assertions.assertFalse(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByParentAnnotation")));
Assertions.assertFalse(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByGrandParentAnnotation"))); Assertions.assertFalse(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByGrandParentAnnotation")));
@ -587,19 +587,19 @@ class MethodMatcherUtilsTest {
@Test @Test
@SneakyThrows @SneakyThrows
void hasAnnotationOnMethodOrDeclaringClass() { void hasAnnotationOnMethodOrDeclaringClass() {
MethodMatcher methodMatcher = MethodMatcherUtils.hasAnnotationOnMethodOrDeclaringClass(GrandParentAnnotation.class); MethodMatcher methodMatcher = MethodMatcherUtil.hasAnnotationOnMethodOrDeclaringClass(GrandParentAnnotation.class);
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByChildAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByChildAnnotation")));
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByParentAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByParentAnnotation")));
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByGrandParentAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByGrandParentAnnotation")));
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("noneAnnotated"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("noneAnnotated")));
methodMatcher = MethodMatcherUtils.hasAnnotationOnMethodOrDeclaringClass(ParentAnnotation.class); methodMatcher = MethodMatcherUtil.hasAnnotationOnMethodOrDeclaringClass(ParentAnnotation.class);
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByChildAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByChildAnnotation")));
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByParentAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByParentAnnotation")));
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByGrandParentAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByGrandParentAnnotation")));
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("noneAnnotated"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("noneAnnotated")));
methodMatcher = MethodMatcherUtils.hasAnnotationOnMethodOrDeclaringClass(ChildAnnotation.class); methodMatcher = MethodMatcherUtil.hasAnnotationOnMethodOrDeclaringClass(ChildAnnotation.class);
Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByChildAnnotation"))); Assertions.assertTrue(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByChildAnnotation")));
Assertions.assertFalse(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByParentAnnotation"))); Assertions.assertFalse(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByParentAnnotation")));
Assertions.assertFalse(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByGrandParentAnnotation"))); Assertions.assertFalse(methodMatcher.test(AnnotatedClass.class.getDeclaredMethod("annotatedByGrandParentAnnotation")));

View File

@ -96,7 +96,7 @@ class MethodScannerTest {
void testGetWithMetadataFromSpecificMethods() { void testGetWithMetadataFromSpecificMethods() {
// find first oneArgMethod method // find first oneArgMethod method
Method[] methods = MethodScanner.getMethods(Child.class); Method[] methods = MethodScanner.getMethods(Child.class);
Map.Entry<Method, Boolean> actual = MethodScanner.getWithMetadataFromSpecificMethods(methods, MethodMatcherUtils.forName("oneArgMethod")); Map.Entry<Method, Boolean> actual = MethodScanner.getWithMetadataFromSpecificMethods(methods, MethodMatcherUtil.forName("oneArgMethod"));
Assertions.assertNotNull(actual); Assertions.assertNotNull(actual);
Method expectedMethod = Parent.class.getDeclaredMethod("oneArgMethod", String.class); Method expectedMethod = Parent.class.getDeclaredMethod("oneArgMethod", String.class);
Assertions.assertEquals(expectedMethod, actual.getKey()); Assertions.assertEquals(expectedMethod, actual.getKey());
@ -108,7 +108,7 @@ class MethodScannerTest {
void testGetFromSpecificMethods() { void testGetFromSpecificMethods() {
// find first oneArgMethod method // find first oneArgMethod method
Method[] methods = MethodScanner.getMethods(Child.class); Method[] methods = MethodScanner.getMethods(Child.class);
Method actual = MethodScanner.getFromSpecificMethods(methods, MethodMatcherUtils.forName("oneArgMethod")); Method actual = MethodScanner.getFromSpecificMethods(methods, MethodMatcherUtil.forName("oneArgMethod"));
Method expectedMethod = Parent.class.getDeclaredMethod("oneArgMethod", String.class); Method expectedMethod = Parent.class.getDeclaredMethod("oneArgMethod", String.class);
Assertions.assertEquals(expectedMethod, actual); Assertions.assertEquals(expectedMethod, actual);
} }

View File

@ -13,7 +13,7 @@
package org.dromara.hutool.core.util; package org.dromara.hutool.core.util;
import org.dromara.hutool.core.reflect.FieldUtil; import org.dromara.hutool.core.reflect.FieldUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.reflect.TypeUtil; import org.dromara.hutool.core.reflect.TypeUtil;
import lombok.Data; import lombok.Data;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;

View File

@ -15,7 +15,7 @@ package org.dromara.hutool.cron.task;
import org.dromara.hutool.core.classloader.ClassLoaderUtil; import org.dromara.hutool.core.classloader.ClassLoaderUtil;
import org.dromara.hutool.core.exception.HutoolException; import org.dromara.hutool.core.exception.HutoolException;
import org.dromara.hutool.core.reflect.ConstructorUtil; import org.dromara.hutool.core.reflect.ConstructorUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.text.StrUtil; import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.cron.CronException; import org.dromara.hutool.cron.CronException;

View File

@ -16,7 +16,7 @@ import org.dromara.hutool.core.collection.CollUtil;
import org.dromara.hutool.core.collection.set.SetUtil; import org.dromara.hutool.core.collection.set.SetUtil;
import org.dromara.hutool.core.func.SerSupplier; import org.dromara.hutool.core.func.SerSupplier;
import org.dromara.hutool.core.map.Dict; import org.dromara.hutool.core.map.Dict;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.text.StrUtil; import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.array.ArrayUtil; import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.util.CharsetUtil; import org.dromara.hutool.core.util.CharsetUtil;

View File

@ -17,7 +17,7 @@ import org.dromara.hutool.core.bean.PropDesc;
import org.dromara.hutool.core.convert.Convert; import org.dromara.hutool.core.convert.Convert;
import org.dromara.hutool.core.lang.Assert; import org.dromara.hutool.core.lang.Assert;
import org.dromara.hutool.core.reflect.ConstructorUtil; import org.dromara.hutool.core.reflect.ConstructorUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.reflect.TypeUtil; import org.dromara.hutool.core.reflect.TypeUtil;
import org.dromara.hutool.core.text.StrUtil; import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.array.ArrayUtil; import org.dromara.hutool.core.array.ArrayUtil;

View File

@ -18,7 +18,7 @@ import org.dromara.hutool.core.bean.copier.CopyOptions;
import org.dromara.hutool.core.convert.Convert; import org.dromara.hutool.core.convert.Convert;
import org.dromara.hutool.core.io.IoUtil; import org.dromara.hutool.core.io.IoUtil;
import org.dromara.hutool.core.lang.mutable.MutableEntry; import org.dromara.hutool.core.lang.mutable.MutableEntry;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.text.StrUtil; import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.json.InternalJSONUtil; import org.dromara.hutool.json.InternalJSONUtil;
import org.dromara.hutool.json.JSONArray; import org.dromara.hutool.json.JSONArray;

View File

@ -14,7 +14,7 @@ package org.dromara.hutool.poi.excel.sax;
import org.dromara.hutool.core.io.IORuntimeException; import org.dromara.hutool.core.io.IORuntimeException;
import org.dromara.hutool.core.io.IoUtil; import org.dromara.hutool.core.io.IoUtil;
import org.dromara.hutool.core.reflect.MethodUtil; import org.dromara.hutool.core.reflect.method.MethodUtil;
import org.dromara.hutool.core.text.StrUtil; import org.dromara.hutool.core.text.StrUtil;
import org.dromara.hutool.core.util.ObjUtil; import org.dromara.hutool.core.util.ObjUtil;
import org.dromara.hutool.poi.excel.sax.handler.RowHandler; import org.dromara.hutool.poi.excel.sax.handler.RowHandler;