public ExecutableFormatter(Executable executable) { String name = ExecutableHelper.getSimpleName( executable ); if ( executable instanceof Method ) { name = executable.getDeclaringClass().getSimpleName() + "#" + name; } Class<?>[] parameterTypes = executable.getParameterTypes(); this.stringRepresentation = ExecutableHelper.getExecutableAsString( name, parameterTypes ); }
@Override public ConstructorConstraintMappingContext constructor(Class<?>... parameterTypes) { Constructor<C> constructor = run( GetDeclaredConstructor.action( beanClass, parameterTypes ) ); if ( constructor == null || constructor.getDeclaringClass() != beanClass ) { throw LOG.getBeanDoesNotContainConstructorException( beanClass, parameterTypes ); } if ( configuredMembers.contains( constructor ) ) { throw LOG.getConstructorHasAlreadyBeConfiguredViaProgrammaticApiException( beanClass, ExecutableHelper.getExecutableAsString( beanClass.getSimpleName(), parameterTypes ) ); } ConstructorConstraintMappingContextImpl context = new ConstructorConstraintMappingContextImpl( this, constructor ); configuredMembers.add( constructor ); executableContexts.add( context ); return context; }
@Override public MethodConstraintMappingContext method(String name, Class<?>... parameterTypes) { Contracts.assertNotNull( name, MESSAGES.methodNameMustNotBeNull() ); Method method = run( GetDeclaredMethod.action( beanClass, name, parameterTypes ) ); if ( method == null || method.getDeclaringClass() != beanClass ) { throw LOG.getBeanDoesNotContainMethodException( beanClass, name, parameterTypes ); } if ( configuredMembers.contains( method ) ) { throw LOG.getMethodHasAlreadyBeConfiguredViaProgrammaticApiException( beanClass, ExecutableHelper.getExecutableAsString( name, parameterTypes ) ); } MethodConstraintMappingContextImpl context = new MethodConstraintMappingContextImpl( this, method ); configuredMembers.add( method ); executableContexts.add( context ); return context; }
ExecutableHelper.getExecutableAsString( executableMetaData.getType().toString() + "#" + executableMetaData.getName(), executableMetaData.getParameterTypes()