@FunctionalInterface public interface FormatValidator
Modifier and Type | Field and Description |
---|---|
static FormatValidator |
NONE
No-operation implementation (never throws {always returns
Optional.empty() ). |
Modifier and Type | Method and Description |
---|---|
static FormatValidator |
forFormat(String formatName)
Static factory method for
FormatValidator implementations supporting the
formatName s mandated by the json schema spec. |
default String |
formatName()
Provides the name of this format.
|
Optional<String> |
validate(String subject)
Implementation-specific validation of
subject . |
static final FormatValidator NONE
Optional.empty()
).static FormatValidator forFormat(String formatName)
FormatValidator
implementations supporting the
formatName
s mandated by the json schema spec.
formatName
- one of the 6 built-in formats.FormatValidator
implementation handling the formatName
format.Optional<String> validate(String subject)
subject
. If a validation error occurs then
implementations should return a programmer-friendly error message as a String wrapped in an
Optional. If the validation succeeded then an empty optional
should be
returned.subject
- the string to be validatedOptional
wrapping the error message if a validation error occured, otherwise
an empty optional
.default String formatName()
Unless specified otherwise the SchemaLoader
will use this
name to recognize string schemas using this format.
"unnamed-format"
. It is strongly
recommended for implementations to give a more meaningful name by overriding this method.Copyright © 2019 Everit Kft.. All rights reserved.