Spec-Zone .ru
спецификации, руководства, описания, API
|
|
|||||||||
ПРЕДЫДУЩИЙ СЛЕДУЮЩИЙ КЛАСС КЛАССА | ФРЕЙМЫ НИКАКИЕ ФРЕЙМЫ | ||||||||
СВОДКА: ВЛОЖЕННЫЙ | ПОЛЕ | CONSTR | МЕТОД | ДЕТАЛЬ: ПОЛЕ | CONSTR | МЕТОД |
public interface Configuration<T extends Configuration<T>>
Получает конфигурационную информацию, выбирает соответствующего Бобового провайдера Проверки допустимости и создает соответствующее ValidatorFactory
.
Configuration<?> configuration = //provided by one of the Validation bootstrap methods
ValidatorFactory = configuration
.messageInterpolator( new CustomMessageInterpolator() )
.buildValidatorFactory();
По умолчанию конфигурационная информация получается от META-INF/validation.xml. Возможно переопределить конфигурацию, полученную от XML-файла при использовании один или больше Configuration
методы. ValidationProviderResolver
определяется во время конфигурации (см. ValidationProvider
). Если ни один явно не требуют, значение по умолчанию ValidationProviderResolver
используется. Провайдер выбирается следующим образом: Validation.byProvider(Class)
, найдите первого провайдера, реализовывая провайдера class требуемый и используйте этоValidationProviderResolver
Method Summary | |
---|---|
T |
addMapping(java.io.InputStream stream)
Add a stream describing constraint mapping in the Bean Validation XML format. |
T |
addProperty(java.lang.String name, java.lang.String value)
Add a provider specific property. |
ValidatorFactory |
buildValidatorFactory()
Build a ValidatorFactory implementation. |
T |
constraintValidatorFactory(ConstraintValidatorFactory constraintValidatorFactory)
Defines the constraint validator factory. |
ConstraintValidatorFactory |
getDefaultConstraintValidatorFactory()
Return an implementation of the ConstraintValidatorFactory interface following the default ConstraintValidatorFactory defined in the specification: uses the public no-arg constructor of the ConstraintValidator
|
MessageInterpolator |
getDefaultMessageInterpolator()
Return an implementation of the MessageInterpolator interface following the default MessageInterpolator defined in the specification: use the ValidationMessages resource bundle to load keys use Locale.getDefault() |
TraversableResolver |
getDefaultTraversableResolver()
Return an implementation of the TraversableResolver interface following the default TraversableResolver defined in the specification: if Java Persistence is available in the runtime environment, a property is considered reachable if Java Persistence considers the property as loaded if Java Persistence is not available in the runtime environment, all properties are considered reachable all properties are considered cascadable. |
T |
ignoreXmlConfiguration()
Ignore data from the META-INF/validation.xml file if this method is called. |
T |
messageInterpolator(MessageInterpolator interpolator)
Defines the message interpolator used. |
T |
traversableResolver(TraversableResolver resolver)
Defines the traversable resolver used. |
Method Detail |
---|
T ignoreXmlConfiguration()
Configuration
methods.
this
following the chaining method pattern.T messageInterpolator(MessageInterpolator interpolator)
null
is passed, the default message interpolator is used (defined in XML or the specification default).
interpolator
- message interpolator implementation. this
following the chaining method pattern.T traversableResolver(TraversableResolver resolver)
null
is passed, the default traversable resolver is used (defined in XML or the specification default).
resolver
- traversable resolver implementation. this
following the chaining method pattern.T constraintValidatorFactory(ConstraintValidatorFactory constraintValidatorFactory)
constraintValidatorFactory
- constraint factory inmplementation. this
following the chaining method pattern.T addMapping(java.io.InputStream stream)
ValidatorFactory
has been built. The Bean Validation provider must not close the stream.
stream
- XML mapping stream. this
following the chaining method pattern. IllegalArgumentException
- if stream
is nullT addProperty(java.lang.String name, java.lang.String value)
Configuration subclass. ValidatorFactory factory = Validation.byProvider(ACMEPrivoder.class) .configure() .providerSpecificProperty(ACMEState.FAST) .buildValidatorFactory();
This method is typically used by containers parsing META-INF/validation.xml themselves and injecting the state to the Configuration object. If a property with a given name is defined both via this method and in the XML configuration, the value set programmatically has priority. If null is passed as a value, the value defined in XML is used. If no value is defined in XML, the property is considered unset.
- Parameters:
name
- property name.value
- property value. - Returns:
this
following the chaining method pattern. - Throws:
IllegalArgumentException
- if name
is null
MessageInterpolator getDefaultMessageInterpolator()
MessageInterpolator
interface following the default MessageInterpolator
defined in the specification:
TraversableResolver getDefaultTraversableResolver()
TraversableResolver
interface following the default TraversableResolver
defined in the specification:
ConstraintValidatorFactory getDefaultConstraintValidatorFactory()
ConstraintValidatorFactory
interface following the default ConstraintValidatorFactory
defined in the specification: ConstraintValidator
ValidatorFactory buildValidatorFactory()
ValidatorFactory
implementation.
ValidationException
- if the ValidatorFactory cannot be built
|
|||||||||
PREV CLASS NEXT CLASS | ФРЕЙМЫ НИКАКИЕ ФРЕЙМЫ | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2009-2011, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to
Generated on 10-February-2011 12:41