Interface ValidationContext
- All Superinterfaces:
RuntimeType.Api<ValidationContextConfig>
Context of
TypeValidator.check(ValidationContext, Object), also used to validate
constraints using #check(ConstraintValidator, Object).-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceScope of a validation operation. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Create a new fluent api builder for aValidationContext.voidcheck(ConstraintValidator validator, Object object) Run the providedcheckon the providedobject.static ValidationContextcreate(ValidationContextConfig config) Create a new validation context from a configuration.static ValidationContextCreate a new validation context for a given root type, where we do not have an instance to serve as root.static ValidationContextCreate a new validation context for a given root type and object.static ValidationContextcreate(Consumer<ValidationContextConfig.Builder> builderConsumer) Create a new validation context customizing its configuration.response()The overall validation response current available on this context.scope(ConstraintViolation.Location location, String name) Enter a new scope.default voidThrows a Validation exception in case the current response is not valid, returns normally otherwise.Methods inherited from interface RuntimeType.Api
prototypeModifier and TypeMethodDescriptionThe prototype as it was received when creating this runtime object instance.
-
Method Details
-
builder
Create a new fluent api builder for aValidationContext.- Returns:
- a new builder
-
create
Create a new validation context from a configuration.- Parameters:
config- configuration to use- Returns:
- a new validation context
-
create
Create a new validation context customizing its configuration.- Parameters:
builderConsumer- consumer to update the builder- Returns:
- a new validation context
-
create
Create a new validation context for a given root type, where we do not have an instance to serve as root.- Parameters:
rootType- type of the root validation object- Returns:
- a new validation context
-
create
Create a new validation context for a given root type and object.- Parameters:
rootType- type of the root validation objectrootObject- instance of the root validation object, note that this may benull- Returns:
- a new validation context
-
response
ValidationResponse response()The overall validation response current available on this context. Calling this method will clear the current response.Alternative method to clear the current response is
throwOnFailure().- Returns:
- the response combined from all
check(io.helidon.validation.spi.ConstraintValidator, Object)calls.
-
throwOnFailure
default void throwOnFailure()Throws a Validation exception in case the current response is not valid, returns normally otherwise. Calling this method will clear the current response. -
check
Run the providedcheckon the providedobject. Adds the validator response to this context's validation response.- Parameters:
validator- the type validator or constraint validator to runobject- the object to check
-
scope
Enter a new scope. The validation context internally maintains a path used to create constraint violations.- Parameters:
location- the location we are enteringname- name of the location (i.e. class name for type, method signature for method)- Returns:
- a new scope, should be used with try with resources to run any checks nested within the scope
- See Also:
-