mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix test
This commit is contained in:
parent
028f498a04
commit
58ce12a8db
@ -291,15 +291,8 @@ public class AnnotationUtil {
|
|||||||
public static ElementType[] getTargetType(final Class<? extends Annotation> annotationType) {
|
public static ElementType[] getTargetType(final Class<? extends Annotation> annotationType) {
|
||||||
final Target target = annotationType.getAnnotation(Target.class);
|
final Target target = annotationType.getAnnotation(Target.class);
|
||||||
if (null == target) {
|
if (null == target) {
|
||||||
return new ElementType[]{ElementType.TYPE, //
|
// 如果没有定义@target元注解,则表示支持所有节点
|
||||||
ElementType.FIELD, //
|
return ElementType.values();
|
||||||
ElementType.METHOD, //
|
|
||||||
ElementType.PARAMETER, //
|
|
||||||
ElementType.CONSTRUCTOR, //
|
|
||||||
ElementType.LOCAL_VARIABLE, //
|
|
||||||
ElementType.ANNOTATION_TYPE, //
|
|
||||||
ElementType.PACKAGE//
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
return target.value();
|
return target.value();
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ package org.dromara.hutool.core.annotation.elements;
|
|||||||
|
|
||||||
import org.dromara.hutool.core.annotation.AnnotationUtil;
|
import org.dromara.hutool.core.annotation.AnnotationUtil;
|
||||||
import org.dromara.hutool.core.collection.CollUtil;
|
import org.dromara.hutool.core.collection.CollUtil;
|
||||||
|
import org.dromara.hutool.core.collection.set.SetUtil;
|
||||||
import org.dromara.hutool.core.reflect.ClassUtil;
|
import org.dromara.hutool.core.reflect.ClassUtil;
|
||||||
import org.dromara.hutool.core.reflect.method.MethodUtil;
|
import org.dromara.hutool.core.reflect.method.MethodUtil;
|
||||||
import org.dromara.hutool.core.text.CharSequenceUtil;
|
import org.dromara.hutool.core.text.CharSequenceUtil;
|
||||||
@ -274,13 +275,13 @@ public class HierarchicalAnnotatedElements implements AnnotatedElement, Iterable
|
|||||||
// ========================= protected =========================
|
// ========================= protected =========================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前元素及层级结构中的关联元素的映射对象
|
* 获取当前元素及层级结构中的关联元素的映射对象,结果只读
|
||||||
*
|
*
|
||||||
* @return 元素映射对象
|
* @return 元素映射对象
|
||||||
*/
|
*/
|
||||||
protected final Set<AnnotatedElement> getElementMappings() {
|
public final Set<AnnotatedElement> getElementMappings() {
|
||||||
initElementMappingsIfNecessary();
|
initElementMappingsIfNecessary();
|
||||||
return elementMappings;
|
return SetUtil.view(this.elementMappings);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,7 +82,7 @@ public class MetaAnnotatedElement<T extends AnnotationMapping<Annotation>> imple
|
|||||||
* @param element 被注解元素
|
* @param element 被注解元素
|
||||||
* @param mappingFactory 创建{@link AnnotationMapping}的工厂方法,返回值为{@code null}时将忽略该注解
|
* @param mappingFactory 创建{@link AnnotationMapping}的工厂方法,返回值为{@code null}时将忽略该注解
|
||||||
*/
|
*/
|
||||||
MetaAnnotatedElement(final AnnotatedElement element, final BiFunction<T, Annotation, T> mappingFactory) {
|
public MetaAnnotatedElement(final AnnotatedElement element, final BiFunction<T, Annotation, T> mappingFactory) {
|
||||||
this.element = Objects.requireNonNull(element);
|
this.element = Objects.requireNonNull(element);
|
||||||
this.mappingFactory = Objects.requireNonNull(mappingFactory);
|
this.mappingFactory = Objects.requireNonNull(mappingFactory);
|
||||||
// 等待懒加载
|
// 等待懒加载
|
||||||
|
@ -11,7 +11,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注解包,提供增强型注解和注解工具类
|
* 注解包,提供增强型注解和注解工具类,处理包括:<br>
|
||||||
|
* <ul>
|
||||||
|
* <li>注解元素(AnnotatedElement)上的注解。</li>
|
||||||
|
* <li>父元素上的注解(包括类、接口、方法、属性)。</li>
|
||||||
|
* <li>注解上的注解。</li>
|
||||||
|
* <li>父元素上的注解上的注解。</li>
|
||||||
|
* </ul>
|
||||||
*
|
*
|
||||||
* @author looly
|
* @author looly
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user