- java.lang.Object
-
- io.github.mmm.validation.AbstractValidationResult
-
- io.github.mmm.validation.ValidationFailure
-
- All Implemented Interfaces:
Localizable
,LocalizableObject
,Composable<ValidationResult>
,ValidationResult
,Iterable<ValidationResult>
public class ValidationFailure extends AbstractValidationResult
Implementation ofValidationResult
for a failure withoutI18N support
.- Since:
- 1.0.0
-
-
Constructor Summary
Constructors Constructor Description ValidationFailure(String code, Localizable message)
The constructor.ValidationFailure(String code, Localizable message, String source)
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ValidationResult
add(ValidationResult result)
String
getLocalizedMessage()
String
getLocalizedMessage(Locale locale)
This method gets the resolved and localized message.void
getLocalizedMessage(Locale locale, Appendable buffer, boolean verbose)
String
getMessage()
ATTENTION:
In most cases you wand to useLocalizable.getLocalizedMessage(Locale)
instead of this method.-
Methods inherited from class io.github.mmm.validation.AbstractValidationResult
appendCode, getCode, getSource, isValid, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.github.mmm.base.lang.Composable
getChild, getChildCount, iterator
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface io.github.mmm.base.i18n.Localizable
getArgument, toLocalizable
-
Methods inherited from interface io.github.mmm.validation.ValidationResult
containsCode, getLocalizedMessage, getLocalizedMessage, getLocalizedMessage, getMessage
-
-
-
-
Constructor Detail
-
ValidationFailure
public ValidationFailure(String code, Localizable message)
The constructor.
-
-
Method Detail
-
getMessage
public String getMessage()
Description copied from interface:Localizable
ATTENTION:
In most cases you wand to useLocalizable.getLocalizedMessage(Locale)
instead of this method.- Returns:
- the untranslated message with arguments filled in. This results in the message in its original language that should typically be English.
- See Also:
ValidationResult.getMessage(boolean)
-
getLocalizedMessage
public String getLocalizedMessage()
Description copied from interface:Localizable
This method tries to get thelocalized message
asString
using thedefault locale
. ATTENTION:
If possible try to avoid using this method and useLocalizable.getLocalizedMessage(Locale)
instead (e.g. using springLocaleContextHolder
to get the users locale).- Returns:
- the localized message.
-
getLocalizedMessage
public String getLocalizedMessage(Locale locale)
Description copied from interface:Localizable
This method gets the resolved and localized message.- Parameters:
locale
- is the locale to translate to.- Returns:
- the localized message.
-
getLocalizedMessage
public void getLocalizedMessage(Locale locale, Appendable buffer, boolean verbose)
- Parameters:
locale
- is theLocale
to translate to.buffer
- theAppendable
where towrite
the message to.verbose
- the verbose flag (to includecode
(s), etc.- See Also:
ValidationResult.getLocalizedMessage(Locale, Appendable)
-
add
public ValidationResult add(ValidationResult result)
- Parameters:
result
- anotherValidationResult
to combine with this one.- Returns:
- the
ValidationResult
composed out of this with the givenresult
. - See Also:
ValidationResultBuilder
-
-