Package org.everit.json.schema.internal
Class URIFormatValidator
- java.lang.Object
-
- org.everit.json.schema.internal.URIFormatValidator
-
- All Implemented Interfaces:
FormatValidator
public class URIFormatValidator extends Object implements FormatValidator
Implementation of the "uri" format value.
-
-
Field Summary
-
Fields inherited from interface org.everit.json.schema.FormatValidator
NONE
-
-
Constructor Summary
Constructors Constructor Description URIFormatValidator()
URIFormatValidator(boolean protocolRelativeURIPermitted)
-
Method Summary
Modifier and Type Method Description protected Optional<String>
failure(String subject)
Deprecated.useOptional.of(String.format("[%s] is not a valid URI", subject))
insteadString
formatName()
Provides the name of this format.Optional<String>
validate(String subject)
Implementation-specific validation ofsubject
.
-
-
-
Method Detail
-
validate
public Optional<String> validate(String subject)
Description copied from interface:FormatValidator
Implementation-specific validation ofsubject
. 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 thenan empty optional
should be returned.- Specified by:
validate
in interfaceFormatValidator
- Parameters:
subject
- the string to be validated- Returns:
- an
Optional
wrapping the error message if a validation error occured, otherwisean empty optional
.
-
failure
@Deprecated protected Optional<String> failure(String subject)
Deprecated.useOptional.of(String.format("[%s] is not a valid URI", subject))
instead
-
formatName
public String formatName()
Description copied from interface:FormatValidator
Provides the name of this format.Unless specified otherwise the
The default implementation of this method returnsSchemaLoader
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.- Specified by:
formatName
in interfaceFormatValidator
- Returns:
- the format name.
-
-