本文整理汇总了Java中org.springframework.core.MethodParameter.getDeclaringClass方法的典型用法代码示例。如果您正苦于以下问题:Java MethodParameter.getDeclaringClass方法的具体用法?Java MethodParameter.getDeclaringClass怎么用?Java MethodParameter.getDeclaringClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.core.MethodParameter
的用法示例。
在下文中一共展示了MethodParameter.getDeclaringClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DependencyDescriptor
import org.springframework.core.MethodParameter; //导入方法依赖的package包/类
/**
* Create a new descriptor for a method or constructor parameter.
* @param methodParameter the MethodParameter to wrap
* @param required whether the dependency is required
* @param eager whether this dependency is 'eager' in the sense of
* eagerly resolving potential target beans for type matching
*/
public DependencyDescriptor(MethodParameter methodParameter, boolean required, boolean eager) {
Assert.notNull(methodParameter, "MethodParameter must not be null");
this.methodParameter = methodParameter;
this.declaringClass = methodParameter.getDeclaringClass();
this.containingClass = methodParameter.getContainingClass();
if (this.methodParameter.getMethod() != null) {
this.methodName = methodParameter.getMethod().getName();
this.parameterTypes = methodParameter.getMethod().getParameterTypes();
}
else {
this.parameterTypes = methodParameter.getConstructor().getParameterTypes();
}
this.parameterIndex = methodParameter.getParameterIndex();
this.required = required;
this.eager = eager;
}