类 AnnotationPlusUtils
- java.lang.Object
-
- com.burukeyou.smartdi.utils.AnnotationPlusUtils
-
public abstract class AnnotationPlusUtils extends Object
-
-
字段概要
字段 修饰符和类型 字段 说明 static StringANNOTATED_ELEMENT_UTILS_CLASS_NAMEThe class name of AnnotatedElementUtils that is introduced since Spring Framework 4
-
构造器概要
构造器 构造器 说明 AnnotationPlusUtils()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static <A extends Annotation>
Map<ElementType,List<A>>findAnnotations(Method method, Class<A> annotationClass)Find specifiedAnnotationtype maps fromMethodstatic org.springframework.core.annotation.AnnotationAttributesgetAnnotationAttributes(Annotation annotation, boolean ignoreDefaultValue, String... ignoreAttributeNames)Get theAnnotationAttributesstatic org.springframework.core.annotation.AnnotationAttributesgetAnnotationAttributes(Annotation annotation, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, String... ignoreAttributeNames)Get theAnnotationAttributesstatic org.springframework.core.annotation.AnnotationAttributesgetAnnotationAttributes(AnnotatedElement annotatedElement, Class<? extends Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, boolean tryMergedAnnotation, String... ignoreAttributeNames)Get theAnnotationAttributes, if the argumenttryMergedAnnotationistrue, theAnnotationAttributeswill be got frommerged annotationfirst, if failed, and then to get fromnormal onestatic org.springframework.core.annotation.AnnotationAttributesgetAnnotationAttributes(AnnotatedElement annotatedElement, Class<? extends Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, String... ignoreAttributeNames)Get theAnnotationAttributesstatic AnnotationMetagetAnnotationMeta(AnnotatedElement annotatedElement, Class<? extends Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, boolean tryMergedAnnotation, String... ignoreAttributeNames)static <T> TgetAttribute(Annotation annotation, String attributeName)Get the attribute valuestatic <T> TgetAttribute(Map<String,Object> attributes, String attributeName)Get the attribute valuestatic <T> TgetAttribute(Map<String,Object> attributes, String attributeName, boolean required)Get the attribute value the willstatic <T> TgetAttribute(Map<String,Object> attributes, String attributeName, T defaultValue)Get the attribute value with default valuestatic Map<String,Object>getAttributes(Annotation annotation, boolean ignoreDefaultValue, String... ignoreAttributeNames)Get theAnnotationattributesstatic Map<String,Object>getAttributes(Annotation annotation, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, String... ignoreAttributeNames)Get theAnnotationattributesstatic Map<String,Object>getAttributes(Map<String,Object> annotationAttributes, org.springframework.core.env.PropertyResolver propertyResolver, String... ignoreAttributeNames)Get theAnnotationattributesstatic <T> TgetRequiredAttribute(Map<String,Object> attributes, String attributeName)Get the required attribute valuestatic <A extends Annotation>
booleanisPresent(Method method, Class<A> annotationClass)Is specifiedAnnotationpresent onMethod's declaring class or parameters or itself.static AnnotationtryGetMergedAnnotation(AnnotatedElement annotatedElement, Class<? extends Annotation> annotationType)Try to get the mergedannotationstatic org.springframework.core.annotation.AnnotationAttributestryGetMergedAnnotationAttributes(AnnotatedElement annotatedElement, Class<? extends Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, String... ignoreAttributeNames)Try to getthe annotation attributesafter merging and resolving the placeholders
-
-
-
方法详细资料
-
isPresent
public static <A extends Annotation> boolean isPresent(Method method, Class<A> annotationClass)
Is specifiedAnnotationpresent onMethod's declaring class or parameters or itself.- 类型参数:
A-Annotationtype- 参数:
method-MethodannotationClass-Annotationtype- 返回:
- If present , return
true, orfalse
-
findAnnotations
public static <A extends Annotation> Map<ElementType,List<A>> findAnnotations(Method method, Class<A> annotationClass)
Find specifiedAnnotationtype maps fromMethod- 类型参数:
A-Annotationtype- 参数:
method-MethodannotationClass-Annotationtype- 返回:
Annotationtype maps , theElementTypeas key , the list ofAnnotationas value. IfAnnotationwas annotated onMethod's parametersElementType.PARAMETER, the associatedAnnotationlist may contain multiple elements.
-
getAttributes
public static Map<String,Object> getAttributes(Annotation annotation, boolean ignoreDefaultValue, String... ignoreAttributeNames)
Get theAnnotationattributes- 参数:
annotation- specifiedAnnotationignoreDefaultValue- whether ignore default value or notignoreAttributeNames- the attribute names of annotation should be ignored- 返回:
- non-null
- 从以下版本开始:
- 1.0.2
-
getAttributes
public static Map<String,Object> getAttributes(Annotation annotation, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, String... ignoreAttributeNames)
Get theAnnotationattributes- 参数:
annotation- specifiedAnnotationpropertyResolver-PropertyResolverinstance, e.gEnvironmentignoreDefaultValue- whether ignore default value or notignoreAttributeNames- the attribute names of annotation should be ignored- 返回:
- non-null
- 从以下版本开始:
- 1.0.2
-
getAttributes
public static Map<String,Object> getAttributes(Map<String,Object> annotationAttributes, org.springframework.core.env.PropertyResolver propertyResolver, String... ignoreAttributeNames)
Get theAnnotationattributes- 参数:
annotationAttributes- the attributes of specifiedAnnotationpropertyResolver-PropertyResolverinstance, e.gEnvironmentignoreAttributeNames- the attribute names of annotation should be ignored- 返回:
- non-null
- 从以下版本开始:
- 1.0.4
-
getAttribute
public static <T> T getAttribute(Annotation annotation, String attributeName)
Get the attribute value- 类型参数:
T- the type of attribute value- 参数:
annotation-annotationattributeName- the name of attribute- 返回:
- the attribute value if found
- 从以下版本开始:
- 1.0.3
-
getAttribute
public static <T> T getAttribute(Map<String,Object> attributes, String attributeName)
Get the attribute value- 类型参数:
T- the type of attribute value- 参数:
attributes-the annotation attributesorAnnotationAttributesattributeName- the name of attribute- 返回:
- the attribute value if found
- 从以下版本开始:
- 1.0.3
-
getAttribute
public static <T> T getAttribute(Map<String,Object> attributes, String attributeName, boolean required)
Get the attribute value the will- 类型参数:
T- the type of attribute value- 参数:
attributes-the annotation attributesorAnnotationAttributesattributeName- the name of attributerequired- the required attribute or not- 返回:
- the attribute value if found
- 抛出:
IllegalStateException- if attribute value can't be found- 从以下版本开始:
- 1.0.6
-
getAttribute
public static <T> T getAttribute(Map<String,Object> attributes, String attributeName, T defaultValue)
Get the attribute value with default value- 类型参数:
T- the type of attribute value- 参数:
attributes-the annotation attributesorAnnotationAttributesattributeName- the name of attributedefaultValue- the default value of attribute- 返回:
- the attribute value if found
- 从以下版本开始:
- 1.0.6
-
getRequiredAttribute
public static <T> T getRequiredAttribute(Map<String,Object> attributes, String attributeName)
Get the required attribute value- 类型参数:
T- the type of attribute value- 参数:
attributes-the annotation attributesorAnnotationAttributesattributeName- the name of attribute- 返回:
- the attribute value if found
- 抛出:
IllegalStateException- if attribute value can't be found- 从以下版本开始:
- 1.0.6
-
getAnnotationAttributes
public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(Annotation annotation, boolean ignoreDefaultValue, String... ignoreAttributeNames)
Get theAnnotationAttributes- 参数:
annotation- specifiedAnnotationignoreDefaultValue- whether ignore default value or notignoreAttributeNames- the attribute names of annotation should be ignored- 返回:
- non-null
- 从以下版本开始:
- 1.0.3
- 另请参阅:
getAnnotationAttributes(Annotation, PropertyResolver, boolean, String...)
-
getAnnotationAttributes
public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(Annotation annotation, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, String... ignoreAttributeNames)
Get theAnnotationAttributes- 参数:
annotation- specifiedAnnotationpropertyResolver-PropertyResolverinstance, e.gEnvironmentignoreDefaultValue- whether ignore default value or notignoreAttributeNames- the attribute names of annotation should be ignored- 返回:
- non-null
- 从以下版本开始:
- 1.0.3
- 另请参阅:
getAttributes(Annotation, PropertyResolver, boolean, String...),getAnnotationAttributes(AnnotatedElement, Class, PropertyResolver, boolean, String...)
-
getAnnotationAttributes
public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(AnnotatedElement annotatedElement, Class<? extends Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, String... ignoreAttributeNames)
Get theAnnotationAttributes- 参数:
annotatedElement-the annotated elementannotationType- thetyoepfannotationpropertyResolver-PropertyResolverinstance, e.gEnvironmentignoreDefaultValue- whether ignore default value or notignoreAttributeNames- the attribute names of annotation should be ignored- 返回:
- if
annotatedElementcan't be found inannotatedElement, returnnull - 从以下版本开始:
- 1.0.3
-
getAnnotationAttributes
public static org.springframework.core.annotation.AnnotationAttributes getAnnotationAttributes(AnnotatedElement annotatedElement, Class<? extends Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, boolean tryMergedAnnotation, String... ignoreAttributeNames)
Get theAnnotationAttributes, if the argumenttryMergedAnnotationistrue, theAnnotationAttributeswill be got frommerged annotationfirst, if failed, and then to get fromnormal one- 参数:
annotatedElement-the annotated elementannotationType- thetyoepfannotationpropertyResolver-PropertyResolverinstance, e.gEnvironmentignoreDefaultValue- whether ignore default value or nottryMergedAnnotation- whether try merged annotation or notignoreAttributeNames- the attribute names of annotation should be ignored- 返回:
- if
annotatedElementcan't be found inannotatedElement, returnnull - 从以下版本开始:
- 1.0.3
-
getAnnotationMeta
public static AnnotationMeta getAnnotationMeta(AnnotatedElement annotatedElement, Class<? extends Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, boolean tryMergedAnnotation, String... ignoreAttributeNames)
-
tryGetMergedAnnotation
public static Annotation tryGetMergedAnnotation(AnnotatedElement annotatedElement, Class<? extends Annotation> annotationType)
Try to get the mergedannotation- 参数:
annotatedElement-the annotated elementannotationType- thetyoepfannotation- 返回:
- If current version of Spring Framework is below 4.2, return
null - 从以下版本开始:
- 1.0.3
-
tryGetMergedAnnotationAttributes
public static org.springframework.core.annotation.AnnotationAttributes tryGetMergedAnnotationAttributes(AnnotatedElement annotatedElement, Class<? extends Annotation> annotationType, org.springframework.core.env.PropertyResolver propertyResolver, boolean ignoreDefaultValue, String... ignoreAttributeNames)
Try to getthe annotation attributesafter merging and resolving the placeholders- 参数:
annotatedElement-the annotated elementannotationType- thetyoepfannotationpropertyResolver-PropertyResolverinstance, e.gEnvironmentignoreDefaultValue- whether ignore default value or notignoreAttributeNames- the attribute names of annotation should be ignored- 返回:
- If the specified annotation type is not found, return
null - 从以下版本开始:
- 1.0.3
-
-