public abstract class NumericValidator extends AbstractKeywordValidator
This class' role is to switch between two different validation methods:
validateLong(ProcessingReport, MessageBundle, FullData) if both the
keyword value and instance fit exactly into a long (for performance
reasons), validateDecimal(ProcessingReport, MessageBundle, FullData)
otherwise (for accuracy reasons).
| Modifier and Type | Field and Description |
|---|---|
protected JsonNode |
number
The keyword value
|
keyword| Modifier | Constructor and Description |
|---|---|
protected |
NumericValidator(String keyword,
JsonNode digest) |
| Modifier and Type | Method and Description |
|---|---|
String |
toString() |
void |
validate(Processor<FullData,FullData> processor,
ProcessingReport report,
MessageBundle bundle,
FullData data)
Validate the instance
|
protected abstract void |
validateDecimal(ProcessingReport report,
MessageBundle bundle,
FullData data)
Method to be implemented by a numeric validator if either of the
keyword value or instance value do not fit into a
long |
protected abstract void |
validateLong(ProcessingReport report,
MessageBundle bundle,
FullData data)
Method to be implemented by a numeric validator if both the keyword
value and instance value fit into a
long |
newMsg, newMsg, toArrayNodeprotected final JsonNode number
public final void validate(Processor<FullData,FullData> processor, ProcessingReport report, MessageBundle bundle, FullData data) throws ProcessingException
KeywordValidatorprocessor - the main validation processorreport - the report to usebundle - the message bundle to usedata - the validation dataInvalidInstanceException - instance is invalid, and the report has
been configured to throw an exception instead of logging errorsProcessingExceptionprotected abstract void validateLong(ProcessingReport report, MessageBundle bundle, FullData data) throws ProcessingException
longreport - the validation reportbundle - the message bundle to usedata - the validation dataProcessingException - a processing error occurred during validationprotected abstract void validateDecimal(ProcessingReport report, MessageBundle bundle, FullData data) throws ProcessingException
longreport - the validation reportbundle - the message bundle to usedata - the validation dataProcessingException - a processing error occurred during validationpublic final String toString()
toString in class AbstractKeywordValidator