public class URIFormatValidator extends Object implements FormatValidator
NONE
Constructor and Description |
---|
URIFormatValidator() |
URIFormatValidator(boolean protocolRelativeURIPermitted) |
Modifier and Type | Method and Description |
---|---|
protected Optional<String> |
failure(String subject)
Deprecated.
use
Optional.of(String.format("[%s] is not a valid URI", subject)) instead |
String |
formatName()
Provides the name of this format.
|
Optional<String> |
validate(String subject)
Implementation-specific validation of
subject . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forFormat
public URIFormatValidator()
public URIFormatValidator(boolean protocolRelativeURIPermitted)
public Optional<String> validate(String subject)
FormatValidator
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.validate
in interface FormatValidator
subject
- the string to be validatedOptional
wrapping the error message if a validation error occured, otherwise
an empty optional
.@Deprecated protected Optional<String> failure(String subject)
Optional.of(String.format("[%s] is not a valid URI", subject))
insteadpublic String formatName()
FormatValidator
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.formatName
in interface FormatValidator
Copyright © 2019 Everit Kft.. All rights reserved.