Java Code Examples for org.springframework.core.MethodParameter#getDeclaringClass()
The following examples show how to use
org.springframework.core.MethodParameter#getDeclaringClass() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommonResponseDataAdvice.java From unified-dispose-springboot with Apache License 2.0 | 6 votes |
private Boolean filter(MethodParameter methodParameter) { Class<?> declaringClass = methodParameter.getDeclaringClass(); // 检查过滤包路径 long count = globalDefaultProperties.getAdviceFilterPackage().stream() .filter(l -> declaringClass.getName().contains(l)).count(); if (count > 0) { return false; } // 检查<类>过滤列表 if (globalDefaultProperties.getAdviceFilterClass().contains(declaringClass.getName())) { return false; } // 检查注解是否存在 if (methodParameter.getDeclaringClass().isAnnotationPresent(IgnoreResponseAdvice.class)) { return false; } if (methodParameter.getMethod().isAnnotationPresent(IgnoreResponseAdvice.class)) { return false; } return true; }
Example 2
Source File: DependencyDescriptor.java From lams with GNU General Public License v2.0 | 6 votes |
/** * 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) { super(methodParameter); this.declaringClass = methodParameter.getDeclaringClass(); 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.containingClass = methodParameter.getContainingClass(); this.required = required; this.eager = eager; }
Example 3
Source File: DependencyDescriptor.java From blog_demos with Apache License 2.0 | 6 votes |
/** * 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; }
Example 4
Source File: DependencyDescriptor.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * 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; }
Example 5
Source File: DependencyDescriptor.java From spring-analysis-note with MIT License | 5 votes |
/** * 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) { super(methodParameter); this.declaringClass = methodParameter.getDeclaringClass(); if (methodParameter.getMethod() != null) { this.methodName = methodParameter.getMethod().getName(); } this.parameterTypes = methodParameter.getExecutable().getParameterTypes(); this.parameterIndex = methodParameter.getParameterIndex(); this.containingClass = methodParameter.getContainingClass(); this.required = required; this.eager = eager; }
Example 6
Source File: DependencyDescriptor.java From java-technology-stack with MIT License | 5 votes |
/** * 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) { super(methodParameter); this.declaringClass = methodParameter.getDeclaringClass(); if (methodParameter.getMethod() != null) { this.methodName = methodParameter.getMethod().getName(); } this.parameterTypes = methodParameter.getExecutable().getParameterTypes(); this.parameterIndex = methodParameter.getParameterIndex(); this.containingClass = methodParameter.getContainingClass(); this.required = required; this.eager = eager; }
Example 7
Source File: CubaDefaultListableBeanFactory.java From cuba with Apache License 2.0 | 5 votes |
protected Class<?> getDeclaringClass(DependencyDescriptor descriptor) { MethodParameter methodParameter = descriptor.getMethodParameter(); if (methodParameter != null) { return methodParameter.getDeclaringClass(); } Field field = descriptor.getField(); if (field != null) { return field.getDeclaringClass(); } throw new AssertionError("Injection must be into a method parameter or field."); }