@Override public HibernateValidatorConfiguration addValidatedValueHandler(ValidatedValueUnwrapper<?> handler) { Contracts.assertNotNull( handler, MESSAGES.parameterMustNotBeNull( "handler" ) ); validatedValueHandlers.add( handler ); return this; }
@Override public HibernateValidatorConfiguration scriptEvaluatorFactory(ScriptEvaluatorFactory scriptEvaluatorFactory) { Contracts.assertNotNull( scriptEvaluatorFactory, MESSAGES.parameterMustNotBeNull( "scriptEvaluatorFactory" ) ); this.scriptEvaluatorFactory = scriptEvaluatorFactory; return this; }
@Override public HibernateValidatorConfiguration constraintValidatorPayload(Object constraintValidatorPayload) { Contracts.assertNotNull( constraintValidatorPayload, MESSAGES.parameterMustNotBeNull( "constraintValidatorPayload" ) ); this.constraintValidatorPayload = constraintValidatorPayload; return this; }
@Override public HibernateValidatorConfiguration externalClassLoader(ClassLoader externalClassLoader) { Contracts.assertNotNull( externalClassLoader, MESSAGES.parameterMustNotBeNull( "externalClassLoader" ) ); this.externalClassLoader = externalClassLoader; return this; }
@Override public HibernateValidatorConfiguration timeProvider(TimeProvider timeProvider) { Contracts.assertNotNull( timeProvider, MESSAGES.parameterMustNotBeNull( "timeProvider" ) ); this.timeProvider = timeProvider; return this; }
@Override public final HibernateValidatorConfiguration addMapping(ConstraintMapping mapping) { Contracts.assertNotNull( mapping, MESSAGES.parameterMustNotBeNull( "mapping" ) ); this.programmaticMappings.add( (DefaultConstraintMapping) mapping ); return this; }
@Override public final HibernateValidatorConfiguration addMapping(ConstraintMapping mapping) { Contracts.assertNotNull( mapping, MESSAGES.parameterMustNotBeNull( "mapping" ) ); this.programmaticMappings.add( (DefaultConstraintMapping) mapping ); return this; }
@Override public HibernateValidatorConfiguration externalClassLoader(ClassLoader externalClassLoader) { Contracts.assertNotNull( externalClassLoader, MESSAGES.parameterMustNotBeNull( "externalClassLoader" ) ); this.externalClassLoader = externalClassLoader; return this; }
@Override public HibernateValidatorConfiguration temporalValidationTolerance(Duration temporalValidationTolerance) { Contracts.assertNotNull( temporalValidationTolerance, MESSAGES.parameterMustNotBeNull( "temporalValidationTolerance" ) ); this.temporalValidationTolerance = temporalValidationTolerance.abs(); return this; }
/** * Retrieves the schema version applying for the given XML input stream as * represented by the "version" attribute of the root element of the stream. * <p> * The given reader will be advanced to the root element of the given XML * structure. It can be used for unmarshalling from there. * * @param resourceName The name of the represented XML resource. * @param xmlEventReader An STAX event reader * * @return The value of the "version" attribute. For compatibility with BV * 1.0, "1.0" will be returned if the given stream doesn't have a * "version" attribute. */ public String getSchemaVersion(String resourceName, XMLEventReader xmlEventReader) { Contracts.assertNotNull( xmlEventReader, MESSAGES.parameterMustNotBeNull( "xmlEventReader" ) ); try { StartElement rootElement = getRootElement( xmlEventReader ); return getVersionValue( rootElement ); } catch (XMLStreamException e) { throw log.getUnableToDetermineSchemaVersionException( resourceName, e ); } }
@Override public HibernateValidatorConfiguration addValueExtractor(ValueExtractor<?> extractor) { Contracts.assertNotNull( extractor, MESSAGES.parameterMustNotBeNull( "extractor" ) ); ValueExtractorDescriptor descriptor = new ValueExtractorDescriptor( extractor ); ValueExtractorDescriptor previous = valueExtractorDescriptors.put( descriptor.getKey(), descriptor ); if ( previous != null ) { throw LOG.getValueExtractorForTypeAndTypeUseAlreadyPresentException( extractor, previous.getValueExtractor() ); } if ( LOG.isDebugEnabled() ) { LOG.debug( "Adding value extractor " + extractor ); } return this; }
/** * Retrieves the schema version applying for the given XML input stream as * represented by the "version" attribute of the root element of the stream. * <p> * The given reader will be advanced to the root element of the given XML * structure. It can be used for unmarshalling from there. * * @param resourceName The name of the represented XML resource. * @param xmlEventReader An STAX event reader * * @return The value of the "version" attribute. For compatibility with BV * 1.0, "1.0" will be returned if the given stream doesn't have a * "version" attribute. */ public String getSchemaVersion(String resourceName, XMLEventReader xmlEventReader) { Contracts.assertNotNull( xmlEventReader, MESSAGES.parameterMustNotBeNull( "xmlEventReader" ) ); try { StartElement rootElement = getRootElement( xmlEventReader ); return getVersionValue( rootElement ); } catch (XMLStreamException e) { throw LOG.getUnableToDetermineSchemaVersionException( resourceName, e ); } }