Spec-Zone .ru
спецификации, руководства, описания, API
|
|
|||||||||
ПРЕДЫДУЩИЙ КЛАСС СЛЕДУЮЩИЙ КЛАСС | ФРЕЙМЫ НИКАКИЕ ФРЕЙМЫ | ||||||||
СВОДКА: ВЛОЖЕННЫЙ | ПОЛЕ | CONSTR | МЕТОД | ДЕТАЛЬ: ПОЛЕ | CONSTR | МЕТОД |
public interface ConstraintValidatorContext
Обеспечьте контекстные данные и работу, применяя данный ограничительный блок проверки допустимости. По крайней мере один ConstraintViolation
должен быть определен (любой значение по умолчанию один, если значение по умолчанию ConstraintViolation
отключается, пользовательский).
Вложенная Сводка Класса | |
---|---|
static interface |
ConstraintValidatorContext.ConstraintViolationBuilder
ConstraintViolation разработчик, позволяющий дополнительно связать отчет нарушения к sub пути. |
Сводка метода | |
---|---|
ConstraintValidatorContext.ConstraintViolationBuilder |
buildConstraintViolationWithTemplate(java.lang.String messageTemplate)
Возвратите ограничительного разработчика нарушения, создающего отчет нарушения, позволяющий дополнительно связать это к sub пути. |
void |
disableDefaultConstraintViolation()
Отключите значение по умолчанию ConstraintViolation объектная генерация (который использует шаблон сообщения, объявленный на ограничении). |
java.lang.String |
getDefaultConstraintMessageTemplate()
|
Деталь метода |
---|
void disableDefaultConstraintViolation()
ConstraintViolation
объектная генерация (который использует шаблон сообщения, объявленный на ограничении). Полезный, чтобы установить различное сообщение нарушения или генерировать a ConstraintViolation
основанный на различном свойстве.
java.lang.String getDefaultConstraintMessageTemplate()
ConstraintValidatorContext.ConstraintViolationBuilder buildConstraintViolationWithTemplate(java.lang.String messageTemplate)
ConstraintViolation
, нужно вызвать любой #addConstraintViolation () методы, доступные в одном из интерфейсов быстрого API. Если другой метод вызывают после #addConstraintViolation () на ConstraintViolationBuilder
или любой из его связанных вложенных интерфейсов IllegalStateException
повышается. Если isValid returns false
, a ConstraintViolation
object will be built per ConstraintViolation report including the default one (unless disableDefaultConstraintViolation()
has been called).
ConstraintViolation
objects generated from such a call contain the same contextual information (root bean, path and so on) unless the path has been overriden. To create a different ConstraintViolation
, a new constraint violation builder has to be retrieved from ConstraintValidatorContext
Here are a few usage examples:
// create new violation report with the default path the constraint is located on
context.buildConstraintViolationWithTemplate( "way too long" )
.addConstraintViolation();
// create new violation report in the "street" subnode of the default path
//the constraint is located on
context.buildConstraintViolationWithTemplate( "way too long" )
.addNode( "street" )
.addConstraintViolation();
//create new violation report in the "addresses["home"].city.name" subnode
//of the default path the constraint is located on
context.buildConstraintViolationWithTemplate( "this detail is wrong" )
.addNode( "addresses" )
.addNode( "country" )
.inIterable().atKey( "home" )
.addNode( "name" )
.addConstraintViolation();
- Parameters:
messageTemplate
- new uninterpolated constraint message. - Returns:
- Returns an constraint violation builder
|
|||||||||
ПРЕДЫДУЩИЙ КЛАСС СЛЕДУЮЩИЙ КЛАСС | ФРЕЙМЫ НИКАКИЕ ФРЕЙМЫ | ||||||||
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