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;
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 java.lang.annotation.Annotation;

View File

@ -12,7 +12,7 @@
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 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.map.WeakConcurrentMap;
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.StrUtil;
import org.dromara.hutool.core.util.ObjUtil;

View File

@ -13,7 +13,7 @@
package org.dromara.hutool.core.annotation;
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 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.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.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.collection.CollUtil;
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 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.map.multi.Graph;
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.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.map.CaseInsensitiveMap;
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.text.StrUtil;
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.reflect.ClassUtil;
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.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.func.LambdaUtil;
import org.dromara.hutool.core.reflect.*;
import org.dromara.hutool.core.reflect.method.MethodUtil;
import java.beans.Transient;
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.classloader.ClassLoaderUtil;
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 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.io.file.FileUtil;
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.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.map.MapUtil;
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.StrUtil;
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.WeakConcurrentMap;
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.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.reflect.*;
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.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.map.WeakConcurrentMap;
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 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.lang.Assert;
import org.dromara.hutool.core.reflect.MethodUtil;
import org.dromara.hutool.core.reflect.method.MethodUtil;
import java.io.InputStream;
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.map.WeakConcurrentMap;
import org.dromara.hutool.core.reflect.lookup.LookupUtil;
import org.dromara.hutool.core.reflect.method.MethodHandleUtil;
import java.lang.invoke.MethodHandle;
import java.lang.reflect.Array;

View File

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

View File

@ -13,7 +13,7 @@
package org.dromara.hutool.core.reflect.kotlin;
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.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.reflect.ConstructorUtil;
import org.dromara.hutool.core.reflect.MethodUtil;
import org.dromara.hutool.core.reflect.method.MethodUtil;
import java.lang.reflect.Method;
import java.util.List;

View File

@ -13,7 +13,7 @@
package org.dromara.hutool.core.reflect.kotlin;
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.util.Objects;

View File

@ -10,7 +10,7 @@
* 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.lang.Assert;

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
* 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.reflect.Constructor;

View File

@ -10,7 +10,7 @@
* 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.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.Singleton;
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.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.MutableObj;
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 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.math.NumberUtil;
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.StrUtil;

View File

@ -17,7 +17,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.FieldNameConstants;
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.Test;
import org.junit.jupiter.api.condition.EnabledForJreRange;

View File

@ -1,6 +1,8 @@
package org.dromara.hutool.core.reflect;
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.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.lang.Console;
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.util.JdkUtil;
import org.junit.jupiter.api.Assertions;

View File

@ -12,7 +12,7 @@
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.Test;

View File

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

View File

@ -96,7 +96,7 @@ class MethodScannerTest {
void testGetWithMetadataFromSpecificMethods() {
// find first oneArgMethod method
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);
Method expectedMethod = Parent.class.getDeclaredMethod("oneArgMethod", String.class);
Assertions.assertEquals(expectedMethod, actual.getKey());
@ -108,7 +108,7 @@ class MethodScannerTest {
void testGetFromSpecificMethods() {
// find first oneArgMethod method
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);
Assertions.assertEquals(expectedMethod, actual);
}

View File

@ -13,7 +13,7 @@
package org.dromara.hutool.core.util;
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 lombok.Data;
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.exception.HutoolException;
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.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.func.SerSupplier;
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.array.ArrayUtil;
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.lang.Assert;
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.text.StrUtil;
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.io.IoUtil;
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.json.InternalJSONUtil;
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.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.util.ObjUtil;
import org.dromara.hutool.poi.excel.sax.handler.RowHandler;