- java.lang.Object
-
- io.github.mmm.validation.ValidationResultValid
-
- All Implemented Interfaces:
io.github.mmm.base.i18n.Localizable
,io.github.mmm.base.i18n.LocalizableObject
,io.github.mmm.base.lang.Composable<ValidationResult>
,ValidationResult
,Iterable<ValidationResult>
public final class ValidationResultValid extends Object implements ValidationResult
ValidationResult
that isvalid
.- Since:
- 1.0.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ValidationResult
add(ValidationResult result)
static ValidationResultValid
get()
String
getCode()
String
getLocalizedMessage()
String
getLocalizedMessage(Locale locale)
void
getLocalizedMessage(Locale locale, Appendable buffer, boolean verbose)
String
getMessage()
String
getSource()
boolean
isValid()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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.validation.ValidationResult
containsCode, getLocalizedMessage, getLocalizedMessage, getLocalizedMessage, getMessage
-
-
-
-
Method Detail
-
isValid
public boolean isValid()
- Specified by:
isValid
in interfaceValidationResult
- Returns:
true
if the validation was successful,false
otherwise. A successfulValidationResult
is always empty. All other methods will not return any resonable result.
-
getSource
public String getSource()
- Specified by:
getSource
in interfaceValidationResult
- Returns:
- the optional
validation source
describing the origin of thevalue
that has been validated. May benull
. If present this may be the filename where the value was read from, an XPath where the value was located in an XML document, the label of a widget of the UI containing the value, etc. This will help to find the problem easier.
-
getMessage
public String getMessage()
- Specified by:
getMessage
in interfaceio.github.mmm.base.i18n.Localizable
- Specified by:
getMessage
in interfaceValidationResult
- See Also:
ValidationResult.getMessage(boolean)
-
getLocalizedMessage
public String getLocalizedMessage()
- Specified by:
getLocalizedMessage
in interfaceio.github.mmm.base.i18n.Localizable
-
getLocalizedMessage
public String getLocalizedMessage(Locale locale)
- Specified by:
getLocalizedMessage
in interfaceio.github.mmm.base.i18n.Localizable
-
getLocalizedMessage
public void getLocalizedMessage(Locale locale, Appendable buffer, boolean verbose)
- Specified by:
getLocalizedMessage
in interfaceValidationResult
- 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)
-
getCode
public String getCode()
- Specified by:
getCode
in interfaceValidationResult
- Returns:
- the failure code or
null
ifvalid
. For a singleValidationFailure
this will be theID
of the failingValidator
. The code is a stable identifier that indicates the type of the failure. It can be used for automated testing in order to make the test-cases independent from the actual message texts so they are maintainable and will not break e.g. if typos are fixed in the messages. - See Also:
ComposedValidationFailure.CODE
-
add
public ValidationResult add(ValidationResult result)
- Specified by:
add
in interfaceValidationResult
- Parameters:
result
- anotherValidationResult
to combine with this one.- Returns:
- the
ValidationResult
composed out of this with the givenresult
. - See Also:
ValidationResultBuilder
-
get
public static ValidationResultValid get()
- Returns:
- the singleton instance of this class.
-
-