|
|
|
@@ -1,9 +1,29 @@ |
|
|
|
package com.xueyi.common.core.utils.core; |
|
|
|
|
|
|
|
import java.lang.annotation.Annotation; |
|
|
|
import java.lang.reflect.Field; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
/** |
|
|
|
* 对象工具类 |
|
|
|
* |
|
|
|
* @author xueyi |
|
|
|
*/ |
|
|
|
public class ObjectUtil extends cn.hutool.core.util.ObjectUtil { |
|
|
|
|
|
|
|
public static Set<String> findAnnotatedFields(Class<?> clazz, Class<? extends Annotation> annotationClass) { |
|
|
|
Set<String> annotatedFields = new HashSet<String>(); |
|
|
|
|
|
|
|
for (Field field : clazz.getDeclaredFields()) { |
|
|
|
if (field.isAnnotationPresent(annotationClass)) { |
|
|
|
annotatedFields.add(field.getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return annotatedFields; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |