本文整理汇总了Java中org.springframework.core.annotation.AnnotationUtils.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationUtils.getValue方法的具体用法?Java AnnotationUtils.getValue怎么用?Java AnnotationUtils.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.core.annotation.AnnotationUtils
的用法示例。
在下文中一共展示了AnnotationUtils.getValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateIfApplicable
import org.springframework.core.annotation.AnnotationUtils; //导入方法依赖的package包/类
/**
* Validate the model attribute if applicable.
* <p>The default implementation checks for {@code @javax.validation.Valid}.
* @param binder the DataBinder to be used
* @param parameter the method parameter
*/
protected void validateIfApplicable(WebDataBinder binder, MethodParameter parameter) {
Annotation[] annotations = parameter.getParameterAnnotations();
for (Annotation annot : annotations) {
if (annot.annotationType().getSimpleName().startsWith("Valid")) {
Object hints = AnnotationUtils.getValue(annot);
binder.validate(hints instanceof Object[] ? (Object[]) hints : new Object[] {hints});
break;
}
}
}
示例2: extractValue
import org.springframework.core.annotation.AnnotationUtils; //导入方法依赖的package包/类
/**
* Extract the value attribute from the given annotation.
*/
protected Object extractValue(Annotation valueAnnotation) {
Object value = AnnotationUtils.getValue(valueAnnotation);
if (value == null) {
throw new IllegalStateException("Value annotation must have a value attribute");
}
return value;
}
示例3: getRequestMqpping
import org.springframework.core.annotation.AnnotationUtils; //导入方法依赖的package包/类
private Annotation getRequestMqpping(Annotation annotation) {
if (AnnotationUtils.getValue(annotation, "method") == null) {
annotation = annotation.annotationType().getDeclaredAnnotation(RequestMapping.class);
}
return annotation;
}
示例4: getAnnotatedQuery
import org.springframework.core.annotation.AnnotationUtils; //导入方法依赖的package包/类
public String getAnnotatedQuery() {
return (String) AnnotationUtils.getValue(queryAnnotation, "value");
}