Package dev.voidframework.validation
Class Validated<T>
java.lang.Object
dev.voidframework.validation.Validated<T>
- Type Parameters:
T- Type of the validated object
A validation result.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Validated<T>emptyOf()Creates an empty validated object.static <T> Validated<T>emptyOf(T instance) Creates an empty validated object.getError()Returns all errors of validated object.Returns a single error for the specific path of validated object.getErrorList(String path) Returns all errors for the specific path of validated object.Returns instance of the validated object.booleanhasError()Indicates if validated object has errors.booleanIndicates if the specific path of validated object has errors.booleanisValid()Indicates if validated object is valid.
-
Method Details
-
emptyOf
Creates an empty validated object.- Type Parameters:
T- Type of the validated object- Returns:
- Newly created instance
-
emptyOf
Creates an empty validated object.- Type Parameters:
T- Type of the validated object- Parameters:
instance- The validated object instance- Returns:
- Newly created instance
-
hasError
public boolean hasError()Indicates if validated object has errors.- Returns:
trueif validated object has one error or more, otherwisefalse
-
hasError
Indicates if the specific path of validated object has errors.- Parameters:
path- The path- Returns:
trueif the specific path of validated object has one error or more, otherwisefalse
-
isValid
public boolean isValid()Indicates if validated object is valid.- Returns:
trueif validated object has no errors, otherwisefalse
-
getError
Returns all errors of validated object.- Returns:
- All errors group by path
-
getError
Returns a single error for the specific path of validated object.- Parameters:
path- The path- Returns:
- The error if exists, otherwise,
null
-
getErrorList
Returns all errors for the specific path of validated object.- Parameters:
path- The path- Returns:
- The error if exists, otherwise,
null
-
getInstance
Returns instance of the validated object.- Returns:
- The validated object
-