@Override public final <C> TypeConstraintMappingContext<C> type(Class<C> type) { Contracts.assertNotNull( type, MESSAGES.beanTypeMustNotBeNull() ); if ( configuredTypes.contains( type ) ) { throw LOG.getBeanClassHasAlreadyBeConfiguredViaProgrammaticApiException( type ); } TypeConstraintMappingContextImpl<C> typeContext = new TypeConstraintMappingContextImpl<>( this, type ); typeContexts.add( typeContext ); configuredTypes.add( type ); return typeContext; }
@Override public final <C> TypeConstraintMappingContext<C> type(Class<C> type) { Contracts.assertNotNull( type, MESSAGES.beanTypeMustNotBeNull() ); if ( configuredTypes.contains( type ) ) { throw log.getBeanClassHasAlreadyBeConfiguredViaProgrammaticApiException( type ); } TypeConstraintMappingContextImpl<C> typeContext = new TypeConstraintMappingContextImpl<C>( this, type ); typeContexts.add( typeContext ); configuredTypes.add( type ); return typeContext; }
private static void assertUniquenessOfConfiguredTypes(Set<DefaultConstraintMapping> mappings) { Set<Class<?>> allConfiguredTypes = newHashSet(); for ( DefaultConstraintMapping constraintMapping : mappings ) { for ( Class<?> configuredType : constraintMapping.getConfiguredTypes() ) { if ( allConfiguredTypes.contains( configuredType ) ) { throw LOG.getBeanClassHasAlreadyBeConfiguredViaProgrammaticApiException( configuredType ); } } allConfiguredTypes.addAll( constraintMapping.getConfiguredTypes() ); } }
private void assertUniquenessOfConfiguredTypes(Set<DefaultConstraintMapping> mappings) { Set<Class<?>> allConfiguredTypes = newHashSet(); for ( DefaultConstraintMapping constraintMapping : mappings ) { for ( Class<?> configuredType : constraintMapping.getConfiguredTypes() ) { if ( allConfiguredTypes.contains( configuredType ) ) { throw log.getBeanClassHasAlreadyBeConfiguredViaProgrammaticApiException( configuredType ); } } allConfiguredTypes.addAll( constraintMapping.getConfiguredTypes() ); } }