- 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
ValidationResultthat isvalid.- Since:
- 1.0.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ValidationResultadd(ValidationResult result)static ValidationResultValidget()StringgetCode()StringgetLocalizedMessage()StringgetLocalizedMessage(Locale locale)voidgetLocalizedMessage(Locale locale, Appendable buffer, boolean verbose)StringgetMessage()StringgetSource()booleanisValid()-
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:
isValidin interfaceValidationResult- Returns:
trueif the validation was successful,falseotherwise. A successfulValidationResultis always empty. All other methods will not return any resonable result.
-
getSource
public String getSource()
- Specified by:
getSourcein interfaceValidationResult- Returns:
- the optional
validation sourcedescribing the origin of thevaluethat 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:
getMessagein interfaceio.github.mmm.base.i18n.Localizable- Specified by:
getMessagein interfaceValidationResult- See Also:
ValidationResult.getMessage(boolean)
-
getLocalizedMessage
public String getLocalizedMessage()
- Specified by:
getLocalizedMessagein interfaceio.github.mmm.base.i18n.Localizable
-
getLocalizedMessage
public String getLocalizedMessage(Locale locale)
- Specified by:
getLocalizedMessagein interfaceio.github.mmm.base.i18n.Localizable
-
getLocalizedMessage
public void getLocalizedMessage(Locale locale, Appendable buffer, boolean verbose)
- Specified by:
getLocalizedMessagein interfaceValidationResult- Parameters:
locale- is theLocaleto translate to.buffer- theAppendablewhere towritethe message to.verbose- the verbose flag (to includecode(s), etc.- See Also:
ValidationResult.getLocalizedMessage(Locale, Appendable)
-
getCode
public String getCode()
- Specified by:
getCodein interfaceValidationResult- Returns:
- the failure code or
nullifvalid. For a singleValidationFailurethis will be theIDof 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:
addin interfaceValidationResult- Parameters:
result- anotherValidationResultto combine with this one.- Returns:
- the
ValidationResultcomposed out of this with the givenresult. - See Also:
ValidationResultBuilder
-
get
public static ValidationResultValid get()
- Returns:
- the singleton instance of this class.
-
-