public class SchemaImpl extends BaseMutableStateValidator implements SchemaInternal
Modifier and Type | Field and Description |
---|---|
protected boolean |
shouldRecordContext |
Constructor and Description |
---|
SchemaImpl(JsonObject schema,
JsonPointer scope,
MutableStateValidator parent) |
Modifier and Type | Method and Description |
---|---|
boolean |
calculateIsSync() |
protected ValidatorContext |
generateValidationContext(ValidatorContext parent) |
JsonObject |
getJson() |
Future<Object> |
getOrApplyDefaultAsync(Object input) |
Object |
getOrApplyDefaultSync(Object input) |
JsonPointer |
getScope() |
protected Future<Void> |
runAsyncValidators(ValidatorContext context,
Object in) |
protected void |
runSyncValidator(ValidatorContext context,
Object in) |
void |
triggerUpdateIsSync()
Manually trigger the sync state update
|
Future<Void> |
validateAsync(Object json)
Validate the json performing an asynchronous validation.
|
Future<Void> |
validateAsync(ValidatorContext context,
Object in)
Return a Future that succeed when the validation succeed, while fail with a
ValidationException when validation fails |
void |
validateSync(Object json)
Validate the json performing a synchronous validation.
|
void |
validateSync(ValidatorContext context,
Object in)
Validate the provided value
|
checkSync, getParent, getPriority, initializeIsSync, isSync, validateSyncAsAsync
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPriority
public SchemaImpl(JsonObject schema, JsonPointer scope, MutableStateValidator parent)
public Future<Void> validateAsync(Object json)
Schema
Note: If the schema is synchronous, this method will call internally this#validateSync(Object)
validateAsync
in interface Schema
json
- input to validateValidationException
if json doesn't match the schema, otherwise a succeeded future.public void validateSync(Object json) throws ValidationException, NoSyncValidationException
Schema
ValidationException
if json doesn't match the schema.validateSync
in interface Schema
json
- input to validateValidationException
- if the input doesn't match the schemaNoSyncValidationException
- If the schema cannot perform a synchronous validationpublic JsonPointer getScope()
public JsonObject getJson()
public Future<Object> getOrApplyDefaultAsync(Object input)
getOrApplyDefaultAsync
in interface SchemaInternal
public Object getOrApplyDefaultSync(Object input)
getOrApplyDefaultSync
in interface SchemaInternal
public void triggerUpdateIsSync()
MutableStateValidator
triggerUpdateIsSync
in interface MutableStateValidator
triggerUpdateIsSync
in class BaseMutableStateValidator
public Future<Void> validateAsync(ValidatorContext context, Object in)
AsyncValidator
ValidationException
when validation failsvalidateAsync
in interface AsyncValidator
public void validateSync(ValidatorContext context, Object in) throws ValidationException, NoSyncValidationException
SyncValidator
validateSync
in interface SyncValidator
ValidationException
- if the object is not validNoSyncValidationException
- if no sync validation can be providedpublic boolean calculateIsSync()
calculateIsSync
in class BaseMutableStateValidator
protected ValidatorContext generateValidationContext(ValidatorContext parent)
protected Future<Void> runAsyncValidators(ValidatorContext context, Object in)
protected void runSyncValidator(ValidatorContext context, Object in)
Copyright © 2022 Eclipse. All rights reserved.