T
- The type of validated entitypublic interface ValidationContext<T>
Modifier and Type | Method and Description |
---|---|
String |
buildMessage(Validation<?> component)
Builds localized error message for the specified validation component
and locale returned by the method
getMessageLocale() . |
T |
getCurrentEntity()
Returns current entity we are validating.
|
Object |
getCurrentIndex()
Returns current item index (or map key) we are validating.
|
ValidationTarget |
getCurrentTarget()
Returns current validation target we are validating.
|
DateFormat |
getDateFormat()
Returns default format of dates for locale returned by the method
getMessageLocale() . |
DateFormat |
getDateFormat(int dateStyle,
int timeStyle)
Returns format of dates for the specified date and time styles and
locale returned by the method
getMessageLocale() . |
DateFormat |
getDateFormat(String pattern)
Returns format of dates for the specified pattern and locale returned by
the method
getMessageLocale() . |
NumberFormat |
getDecimalFormat()
Returns default format of decimal numbers for locale returned by the
method
getMessageLocale() . |
NumberFormat |
getDecimalFormat(String pattern)
Returns format of decimal numbers for the specified pattern and locale
returned by the method
getMessageLocale() . |
<V> ElementMetaData<T,V> |
getElementMetaData()
Returns metadata of the current element we are validating.
|
String |
getElementName()
Returns name of the element defined on the entity we are validating.
|
Class<?> |
getElementType()
Returns type of the element defined on the entity we are validating.
|
EntityMetaData<T> |
getEntityMetaData()
Returns metadata of the current entity we are validating.
|
Class<T> |
getEntityType()
Returns type of the entity we are validating.
|
NumberFormat |
getIntegerFormat()
Returns default format of integer numbers for locale returned by the
method
getMessageLocale() . |
NumberFormat |
getIntegerFormat(String pattern)
Returns format of integer numbers for the specified pattern and locale
returned by the method
getMessageLocale() . |
Locale |
getMessageLocale()
Returns locale to be used for error messages and formatting numbers,
dates, etc.
|
PropertyFilter |
getPropertyFilter()
Returns filter to be used for property filtering.
|
Object |
getRootEntity()
Returns root entity being validated.
|
String[] |
getValidatingGroups()
Returns array of constraint groups to be validated.
|
Validator<T> |
getValidator()
Returns validator used for entity validation.
|
boolean |
isFailFast()
Determines if validation should fail on the first violation.
|
boolean |
isLocalizedConvert()
Determines if converters should take locale into account.
|
String |
resolveMessage(String key)
Returns localized message for the specified key and locale returned by
the method
getMessageLocale() . |
void |
setCurrentIndex(Object index)
Sets current item index (or map key) we are validating.
|
void |
setCurrentTarget(ValidationTarget target)
Sets current validation target we are validating.
|
Validator<T> getValidator()
Class<T> getEntityType()
EntityMetaData<T> getEntityMetaData()
Class<?> getElementType()
String getElementName()
<V> ElementMetaData<T,V> getElementMetaData()
V
- The element type.Object getRootEntity()
T getCurrentEntity()
ValidationTarget getCurrentTarget()
void setCurrentTarget(ValidationTarget target)
target
- Current validation target we are validating.Object getCurrentIndex()
void setCurrentIndex(Object index)
index
- Current item index (or map key) we are validating.Locale getMessageLocale()
PropertyFilter getPropertyFilter()
String[] getValidatingGroups()
boolean isLocalizedConvert()
true
if converters should take locale into
account; false
otherwise.boolean isFailFast()
true
if validation should fail on the first
violation; false
otherwise.NumberFormat getIntegerFormat()
getMessageLocale()
. The format returned is based on the
pattern that was configured by the validator factory. If default pattern
is not configured then integer number format supported by JRE will be
returned.NumberFormat getIntegerFormat(String pattern)
getMessageLocale()
. If the specified
pattern is null
then default format will be returned.pattern
- Integer number pattern.getIntegerFormat()
NumberFormat getDecimalFormat()
getMessageLocale()
. The format returned is based on the
pattern that was configured by the validator factory. If default pattern
is not configured then decimal number format supported by JRE will be
returned.NumberFormat getDecimalFormat(String pattern)
getMessageLocale()
. If the specified
pattern is null
then default format will be returned.pattern
- Decimal number pattern.getDecimalFormat()
DateFormat getDateFormat()
getMessageLocale()
. The format returned is based on the pattern
if it was configured by the validator factory. If default pattern is not
configured then date format based on date and time styles will be
returned.DateFormat getDateFormat(String pattern)
getMessageLocale()
. If the specified pattern is
null
then default format will be returned.pattern
- Date pattern.getDateFormat()
DateFormat getDateFormat(int dateStyle, int timeStyle)
getMessageLocale()
. If both of
the specified styles are negative values then default format will be
returned.dateStyle
- Date style.timeStyle
- Time style.getDateFormat()
String resolveMessage(String key)
getMessageLocale()
.key
- Key of a message in a bundle.String buildMessage(Validation<?> component)
getMessageLocale()
.component
- Validation component.Copyright © 2011–2020 FoxLabs. All rights reserved.