Package kos.core.validation
Class DefaultValidation
- java.lang.Object
-
- kos.core.validation.DefaultValidation
-
- All Implemented Interfaces:
Validation
public class DefaultValidation extends Object implements Validation
A predicate-basedValidation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classDefaultValidation.AlwaysValidAValidationthat assume all objects are valid.
-
Field Summary
Fields Modifier and Type Field Description private ValidationfallbackValidationThe fallbackValidationimplementation.private Map<Class,Validation>validationCache
-
Constructor Summary
Constructors Constructor Description DefaultValidation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<Object>getTypeOfTheObjectBeingValidated()Returns a static representation of the object being validated.voidmemorise(Validation validation)private voidpopulateWithClassAndItsInterfaces(Queue<Class> stack, Class klass)io.vertx.core.Futurevalidate(Object object, Class targetClass)Validates theobject.
-
-
-
Field Detail
-
validationCache
private final Map<Class,Validation> validationCache
-
fallbackValidation
private Validation fallbackValidation
The fallbackValidationimplementation. It will be called whenever no other validation is available for a given type.
-
-
Method Detail
-
memorise
public void memorise(Validation validation)
-
validate
public io.vertx.core.Future validate(Object object, Class targetClass)
Description copied from interface:ValidationValidates theobject. It is expected that the validated object will be returned in the successfulFutureresult.- Specified by:
validatein interfaceValidation- Parameters:
object- the object to be validated
-
populateWithClassAndItsInterfaces
private void populateWithClassAndItsInterfaces(Queue<Class> stack, Class klass)
-
getTypeOfTheObjectBeingValidated
public Class<Object> getTypeOfTheObjectBeingValidated()
Description copied from interface:ValidationReturns a static representation of the object being validated.- Specified by:
getTypeOfTheObjectBeingValidatedin interfaceValidation
-
-