本文整理汇总了Java中org.springframework.core.type.MethodMetadata.getMethodName方法的典型用法代码示例。如果您正苦于以下问题:Java MethodMetadata.getMethodName方法的具体用法?Java MethodMetadata.getMethodName怎么用?Java MethodMetadata.getMethodName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.core.type.MethodMetadata
的用法示例。
在下文中一共展示了MethodMetadata.getMethodName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addDeducedBeanTypeForBeanMethod
import org.springframework.core.type.MethodMetadata; //导入方法依赖的package包/类
private void addDeducedBeanTypeForBeanMethod(ConditionContext context,
AnnotatedTypeMetadata metadata, final List<String> beanTypes,
final MethodMetadata methodMetadata) {
try {
// We should be safe to load at this point since we are in the
// REGISTER_BEAN phase
Class<?> configClass = ClassUtils.forName(
methodMetadata.getDeclaringClassName(), context.getClassLoader());
ReflectionUtils.doWithMethods(configClass, new MethodCallback() {
@Override
public void doWith(Method method)
throws IllegalArgumentException, IllegalAccessException {
if (methodMetadata.getMethodName().equals(method.getName())) {
beanTypes.add(method.getReturnType().getName());
}
}
});
}
catch (Throwable ex) {
throw new BeanTypeDeductionException(
methodMetadata.getDeclaringClassName(),
methodMetadata.getMethodName(), ex);
}
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:25,代码来源:OnBeanCondition.java
示例2: addDeducedBeanTypeForBeanMethod
import org.springframework.core.type.MethodMetadata; //导入方法依赖的package包/类
private void addDeducedBeanTypeForBeanMethod(ConditionContext context,
MethodMetadata metadata, final List<String> beanTypes) {
try {
// We should be safe to load at this point since we are in the
// REGISTER_BEAN phase
Class<?> returnType = ClassUtils.forName(metadata.getReturnTypeName(), context.getClassLoader());
beanTypes.add(returnType.getName());
} catch (Throwable ex) {
throw new BeanTypeDeductionException(metadata.getDeclaringClassName(), metadata.getMethodName(), ex);
}
}
示例3: addDeducedBeanTypeForBeanMethod
import org.springframework.core.type.MethodMetadata; //导入方法依赖的package包/类
private void addDeducedBeanTypeForBeanMethod(ConditionContext context,
MethodMetadata metadata, final List<String> beanTypes) {
try {
// We should be safe to load at this point since we are in the
// REGISTER_BEAN phase
Class<?> returnType = ClassUtils.forName(metadata.getReturnTypeName(),
context.getClassLoader());
beanTypes.add(returnType.getName());
}
catch (Throwable ex) {
throw new BeanTypeDeductionException(metadata.getDeclaringClassName(),
metadata.getMethodName(), ex);
}
}
示例4: getName
import org.springframework.core.type.MethodMetadata; //导入方法依赖的package包/类
private String getName(AnnotatedTypeMetadata metadata) {
if (metadata instanceof AnnotationMetadata) {
return ((AnnotationMetadata) metadata).getClassName();
}
if (metadata instanceof MethodMetadata) {
MethodMetadata methodMetadata = (MethodMetadata) metadata;
return methodMetadata.getDeclaringClassName() + "."
+ methodMetadata.getMethodName();
}
return metadata.toString();
}
示例5: getClassOrMethodName
import org.springframework.core.type.MethodMetadata; //导入方法依赖的package包/类
private static String getClassOrMethodName(AnnotatedTypeMetadata metadata) {
if (metadata instanceof ClassMetadata) {
ClassMetadata classMetadata = (ClassMetadata) metadata;
return classMetadata.getClassName();
}
MethodMetadata methodMetadata = (MethodMetadata) metadata;
return methodMetadata.getDeclaringClassName() + "#"
+ methodMetadata.getMethodName();
}