本文整理汇总了Java中org.springframework.core.annotation.AnnotatedElementUtils.getMergedAnnotation方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotatedElementUtils.getMergedAnnotation方法的具体用法?Java AnnotatedElementUtils.getMergedAnnotation怎么用?Java AnnotatedElementUtils.getMergedAnnotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.core.annotation.AnnotatedElementUtils
的用法示例。
在下文中一共展示了AnnotatedElementUtils.getMergedAnnotation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMethodHandlerMethodFunction
import org.springframework.core.annotation.AnnotatedElementUtils; //导入方法依赖的package包/类
private HandlerMethod getMethodHandlerMethodFunction(Object consumer, Method method) {
final EventMapping mapping = AnnotatedElementUtils.getMergedAnnotation(method, EventMapping.class);
if (mapping == null) {
return null;
}
Preconditions.checkState(method.getParameterCount() == 1,
"Number of parameter should be 1. But {}",
(Object[]) method.getParameterTypes());
// TODO: Support more than 1 argument. Like MVC's argument resolver?
final Type type = method.getGenericParameterTypes()[0];
final Predicate<Event> predicate = new EventPredicate(type);
return new HandlerMethod(predicate, consumer, method,
getPriority(mapping, type));
}
示例2: customizeContext
import org.springframework.core.annotation.AnnotatedElementUtils; //导入方法依赖的package包/类
@Override
public void customizeContext(ConfigurableApplicationContext context,
MergedContextConfiguration mergedContextConfiguration) {
SpringBootTest annotation = AnnotatedElementUtils.getMergedAnnotation(
mergedContextConfiguration.getTestClass(), SpringBootTest.class);
if (annotation.webEnvironment().isEmbedded()) {
registerTestRestTemplate(context);
}
}
示例3: processDeps
import org.springframework.core.annotation.AnnotatedElementUtils; //导入方法依赖的package包/类
private static boolean processDeps(List<Dependency> deps, AnnotatedElement ao) {
if(!(AnnotatedElementUtils.isAnnotated(ao, Autowired.class))) {
return false;
}
Qualifier qualifier = AnnotatedElementUtils.getMergedAnnotation(ao, Qualifier.class);
String name = qualifier == null ? null : qualifier.value();
Class<?> type = (ao instanceof Field)? ((Field)ao).getType() : ((Method)ao).getReturnType();
deps.add(new Dependency(name, type));
return true;
}
示例4: convertToString
import org.springframework.core.annotation.AnnotatedElementUtils; //导入方法依赖的package包/类
private String convertToString(Field field, Object value) {
Class<?> targetType = field.getType();
if (Collection.class.isAssignableFrom(field.getType())) {
targetType = resolveCollectionItemType(field);
if (((Collection) value).isEmpty()) {
return "";
}
else {
ServletContextInitParameter servletContextInitParameter = AnnotatedElementUtils.getMergedAnnotation(field, ServletContextInitParameter.class);
Iterator iterator = ((Collection) value).iterator();
String firstValue = convertToString(targetType, iterator.next());
StringBuilder sb = new StringBuilder(firstValue);
while (iterator.hasNext()) {
String nextValue = convertToString(targetType, iterator.next());
sb.append(servletContextInitParameter.listSeparator()).append(nextValue);
}
return sb.toString();
}
}
else {
return convertToString(targetType, value);
}
}
示例5: findMergedAnnotation
import org.springframework.core.annotation.AnnotatedElementUtils; //导入方法依赖的package包/类
private Annotation findMergedAnnotation(Class<?> source,
Class<? extends Annotation> annotationType) {
if (source == null) {
return null;
}
Annotation mergedAnnotation = AnnotatedElementUtils.getMergedAnnotation(source,
annotationType);
return mergedAnnotation != null ? mergedAnnotation
: findMergedAnnotation(source.getSuperclass(), annotationType);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:AnnotationsPropertySource.java
示例6: get
import org.springframework.core.annotation.AnnotatedElementUtils; //导入方法依赖的package包/类
private FilterAnnotations get(Class<?> type) {
Filters filters = AnnotatedElementUtils.getMergedAnnotation(type, Filters.class);
return new FilterAnnotations(getClass().getClassLoader(), filters.value());
}
示例7: DataMongoTypeExcludeFilter
import org.springframework.core.annotation.AnnotatedElementUtils; //导入方法依赖的package包/类
DataMongoTypeExcludeFilter(final Class<?> testClass) {
this.annotation = AnnotatedElementUtils.getMergedAnnotation(testClass,
DataMongoTest.class);
}
开发者ID:michael-simons,项目名称:datamongotest-autoconfigure-spring-boot-DEPRECATED-,代码行数:5,代码来源:DataMongoTypeExcludeFilter.java
示例8: DataJpaTypeExcludeFilter
import org.springframework.core.annotation.AnnotatedElementUtils; //导入方法依赖的package包/类
DataJpaTypeExcludeFilter(Class<?> testClass) {
this.annotation = AnnotatedElementUtils.getMergedAnnotation(testClass,
DataJpaTest.class);
}
示例9: WebMvcTypeExcludeFilter
import org.springframework.core.annotation.AnnotatedElementUtils; //导入方法依赖的package包/类
WebMvcTypeExcludeFilter(Class<?> testClass) {
this.annotation = AnnotatedElementUtils.getMergedAnnotation(testClass,
WebMvcTest.class);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:5,代码来源:WebMvcTypeExcludeFilter.java
示例10: RestClientExcludeFilter
import org.springframework.core.annotation.AnnotatedElementUtils; //导入方法依赖的package包/类
RestClientExcludeFilter(Class<?> testClass) {
this.annotation = AnnotatedElementUtils.getMergedAnnotation(testClass,
RestClientTest.class);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:5,代码来源:RestClientExcludeFilter.java
示例11: JsonExcludeFilter
import org.springframework.core.annotation.AnnotatedElementUtils; //导入方法依赖的package包/类
JsonExcludeFilter(Class<?> testClass) {
this.annotation = AnnotatedElementUtils.getMergedAnnotation(testClass,
JsonTest.class);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:5,代码来源:JsonExcludeFilter.java
示例12: shouldInitializeFields
import org.springframework.core.annotation.AnnotatedElementUtils; //导入方法依赖的package包/类
private boolean shouldInitializeFields(TestContext testContext) {
AutoConfigureJsonTesters annotation = AnnotatedElementUtils.getMergedAnnotation(
testContext.getTestClass(), AutoConfigureJsonTesters.class);
return (annotation != null && annotation.initFields());
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:6,代码来源:JsonTesterInitializationTestExecutionListener.java
示例13: getAnnotation
import org.springframework.core.annotation.AnnotatedElementUtils; //导入方法依赖的package包/类
protected SpringBootTest getAnnotation(Class<?> testClass) {
return AnnotatedElementUtils.getMergedAnnotation(testClass, SpringBootTest.class);
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:4,代码来源:SpringBootTestContextBootstrapper.java
示例14: findAnnotation
import org.springframework.core.annotation.AnnotatedElementUtils; //导入方法依赖的package包/类
private SchedulerLock findAnnotation(Method method) {
return AnnotatedElementUtils.getMergedAnnotation(method, SchedulerLock.class);
}
示例15: SpringletsWebMvcExcludeFilter
import org.springframework.core.annotation.AnnotatedElementUtils; //导入方法依赖的package包/类
SpringletsWebMvcExcludeFilter(Class<?> testClass) {
this.annotation =
AnnotatedElementUtils.getMergedAnnotation(testClass, SpringletsWebMvcTest.class);
}