/** * Create a new SynthesizingMethodParameter for the given parameter descriptor. * <p>This is a convenience factory method for scenarios where a * Java 8 {@link Parameter} descriptor is already available. * @param parameter the parameter descriptor * @return the corresponding SynthesizingMethodParameter instance * @since 5.0 */ public static SynthesizingMethodParameter forParameter(Parameter parameter) { return forExecutable(parameter.getDeclaringExecutable(), findParameterIndex(parameter)); }
/** * Create a new SynthesizingMethodParameter for the given parameter descriptor. * <p>This is a convenience factory method for scenarios where a * Java 8 {@link Parameter} descriptor is already available. * @param parameter the parameter descriptor * @return the corresponding SynthesizingMethodParameter instance * @since 5.0 */ public static SynthesizingMethodParameter forParameter(Parameter parameter) { return forExecutable(parameter.getDeclaringExecutable(), findParameterIndex(parameter)); }
@Test public void testFactoryMethods() { assertEquals(stringParameter, SynthesizingMethodParameter.forExecutable(method, 0)); assertEquals(longParameter, SynthesizingMethodParameter.forExecutable(method, 1)); assertEquals(stringParameter, SynthesizingMethodParameter.forParameter(method.getParameters()[0])); assertEquals(longParameter, SynthesizingMethodParameter.forParameter(method.getParameters()[1])); }
boolean required = (autowired == null || autowired.required()); MethodParameter methodParameter = SynthesizingMethodParameter.forExecutable( parameter.getDeclaringExecutable(), parameterIndex); DependencyDescriptor descriptor = new DependencyDescriptor(methodParameter, required);
/** * Create a new SynthesizingMethodParameter for the given parameter descriptor. * <p>This is a convenience factory method for scenarios where a * Java 8 {@link Parameter} descriptor is already available. * @param parameter the parameter descriptor * @return the corresponding SynthesizingMethodParameter instance * @since 5.0 */ public static SynthesizingMethodParameter forParameter(Parameter parameter) { return forExecutable(parameter.getDeclaringExecutable(), findParameterIndex(parameter)); }
/** * Create a new SynthesizingMethodParameter for the given parameter descriptor. * <p>This is a convenience factory method for scenarios where a * Java 8 {@link Parameter} descriptor is already available. * @param parameter the parameter descriptor * @return the corresponding SynthesizingMethodParameter instance * @since 5.0 */ public static SynthesizingMethodParameter forParameter(Parameter parameter) { return forExecutable(parameter.getDeclaringExecutable(), findParameterIndex(parameter)); }
boolean required = (autowired == null || autowired.required()); MethodParameter methodParameter = SynthesizingMethodParameter.forExecutable( parameter.getDeclaringExecutable(), parameterIndex); DependencyDescriptor descriptor = new DependencyDescriptor(methodParameter, required);
boolean required = (autowired == null || autowired.required()); MethodParameter methodParameter = SynthesizingMethodParameter.forExecutable( parameter.getDeclaringExecutable(), parameterIndex); DependencyDescriptor descriptor = new DependencyDescriptor(methodParameter, required);