private void validateParameters(ScriptAssert constraintAnnotation) { Contracts.assertNotEmpty( constraintAnnotation.script(), MESSAGES.parameterMustNotBeEmpty( "script" ) ); Contracts.assertNotEmpty( constraintAnnotation.lang(), MESSAGES.parameterMustNotBeEmpty( "lang" ) ); Contracts.assertNotEmpty( constraintAnnotation.alias(), MESSAGES.parameterMustNotBeEmpty( "alias" ) ); } }
private void validateParameters(ScriptAssert constraintAnnotation) { Contracts.assertNotEmpty( constraintAnnotation.script(), MESSAGES.parameterMustNotBeEmpty( "script" ) ); Contracts.assertNotEmpty( constraintAnnotation.lang(), MESSAGES.parameterMustNotBeEmpty( "lang" ) ); Contracts.assertNotEmpty( constraintAnnotation.alias(), MESSAGES.parameterMustNotBeEmpty( "alias" ) ); } }
private void validateParameters(ParameterScriptAssert constraintAnnotation) { Contracts.assertNotEmpty( constraintAnnotation.script(), MESSAGES.parameterMustNotBeEmpty( "script" ) ); Contracts.assertNotEmpty( constraintAnnotation.lang(), MESSAGES.parameterMustNotBeEmpty( "lang" ) ); } }
private void validateParameters(ParameterScriptAssert constraintAnnotation) { Contracts.assertNotEmpty( constraintAnnotation.script(), MESSAGES.parameterMustNotBeEmpty( "script" ) ); Contracts.assertNotEmpty( constraintAnnotation.lang(), MESSAGES.parameterMustNotBeEmpty( "lang" ) ); } }
/** * Used to find the maximally specific and container element compliant value extractor based on the runtime type. * <p> * The maximally specific one is chosen among the candidates passed to this method. * <p> * Used for cascading validation. * * @see ValueExtractorResolver#getMaximallySpecificAndRuntimeContainerElementCompliantValueExtractor(Type, * TypeVariable, Class, Collection) * @throws ConstraintDeclarationException if more than 2 maximally specific container-element-compliant value extractors are found */ public ValueExtractorDescriptor getMaximallySpecificAndRuntimeContainerElementCompliantValueExtractor(Type declaredType, TypeVariable<?> typeParameter, Class<?> runtimeType, Collection<ValueExtractorDescriptor> valueExtractorCandidates) { Contracts.assertNotEmpty( valueExtractorCandidates, "Value extractor candidates cannot be empty" ); if ( valueExtractorCandidates.size() == 1 ) { return valueExtractorCandidates.iterator().next(); } else { return getUniqueValueExtractorOrThrowException( runtimeType, getRuntimeAndContainerElementCompliantValueExtractorsFromPossibleCandidates( declaredType, typeParameter, runtimeType, valueExtractorCandidates ) ); } }
@Override public PropertyConstraintMappingContext property(String property, ElementType elementType) { Contracts.assertNotNull( property, "The property name must not be null." ); Contracts.assertNotNull( elementType, "The element type must not be null." ); Contracts.assertNotEmpty( property, MESSAGES.propertyNameMustNotBeEmpty() ); Member member = getMember( beanClass, property, elementType ); if ( member == null || member.getDeclaringClass() != beanClass ) { throw LOG.getUnableToFindPropertyWithAccessException( beanClass, property, elementType ); } if ( configuredMembers.contains( member ) ) { throw LOG.getPropertyHasAlreadyBeConfiguredViaProgrammaticApiException( beanClass, property ); } PropertyConstraintMappingContextImpl context = new PropertyConstraintMappingContextImpl( this, member ); configuredMembers.add( member ); propertyContexts.add( context ); return context; }
@Override public PropertyConstraintMappingContext property(String property, ElementType elementType) { Contracts.assertNotNull( property, "The property name must not be null." ); Contracts.assertNotNull( elementType, "The element type must not be null." ); Contracts.assertNotEmpty( property, MESSAGES.propertyNameMustNotBeEmpty() ); Member member = getMember( beanClass, property, elementType ); if ( member == null || member.getDeclaringClass() != beanClass ) { throw log.getUnableToFindPropertyWithAccessException( beanClass, property, elementType ); } if ( configuredMembers.contains( member ) ) { throw log.getPropertyHasAlreadyBeConfiguredViaProgrammaticApiException( beanClass, property ); } PropertyConstraintMappingContextImpl context = new PropertyConstraintMappingContextImpl( this, member ); configuredMembers.add( member ); propertyContexts.add( context ); return context; }