public MethodElement(Method method) { super( method.getName(), method.getParameterTypes() ); this.method = method; isGetterMethod = ReflectionHelper.isGetterMethod( method ); }
this.parameterMetaData = CollectionHelper.toImmutableList( parameterMetaData ); this.hasParameterConstraints = hasParameterConstraints( parameterMetaData ) || !crossParameterConstraints.isEmpty(); this.isGetterMethod = ReflectionHelper.isGetterMethod( executable );
private <T> void determineConstrainedMethods(AnnotatedType<T> type, BeanDescriptor beanDescriptor, Set<AnnotatedCallable<? super T>> callables) { List<Method> overriddenAndImplementedMethods = InheritedMethodsHelper.getAllMethods( type.getJavaClass() ); for ( AnnotatedMethod<? super T> annotatedMethod : type.getMethods() ) { Method method = annotatedMethod.getJavaMember(); boolean isGetter = ReflectionHelper.isGetterMethod( method ); // obtain @ValidateOnExecution from the top-most method in the hierarchy Method methodForExecutableTypeRetrieval = replaceWithOverriddenOrInterfaceMethod( method, overriddenAndImplementedMethods ); EnumSet<ExecutableType> classLevelExecutableTypes = executableTypesDefinedOnType( methodForExecutableTypeRetrieval.getDeclaringClass() ); EnumSet<ExecutableType> memberLevelExecutableType = executableTypesDefinedOnMethod( methodForExecutableTypeRetrieval, isGetter ); ExecutableType currentExecutableType = isGetter ? ExecutableType.GETTER_METHODS : ExecutableType.NON_GETTER_METHODS; // validation is enabled per default, so explicit configuration can just veto whether // validation occurs if ( veto( classLevelExecutableTypes, memberLevelExecutableType, currentExecutableType ) ) { continue; } boolean needsValidation; if ( isGetter ) { needsValidation = isGetterConstrained( method, beanDescriptor ); } else { needsValidation = isNonGetterConstrained( method, beanDescriptor ); } if ( needsValidation ) { callables.add( annotatedMethod ); } } }