Class HostnameFormatValidator

  • All Implemented Interfaces:
    FormatValidator

    public class HostnameFormatValidator
    extends java.lang.Object
    implements FormatValidator
    Implementation of the "hostname" format value.
    • Method Summary

      Modifier and Type Method Description
      java.lang.String formatName()
      Provides the name of this format.
      java.util.Optional<java.lang.String> validate​(java.lang.String subject)
      Implementation-specific validation of subject.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HostnameFormatValidator

        public HostnameFormatValidator()
    • Method Detail

      • validate

        public java.util.Optional<java.lang.String> validate​(java.lang.String subject)
        Description copied from interface: FormatValidator
        Implementation-specific validation of 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.
        Specified by:
        validate in interface FormatValidator
        Parameters:
        subject - the string to be validated
        Returns:
        an Optional wrapping the error message if a validation error occured, otherwise an empty optional.
      • formatName

        public java.lang.String formatName()
        Description copied from interface: FormatValidator
        Provides the name of this format.

        Unless specified otherwise the SchemaLoader will use this name to recognize string schemas using this format.

        The default implementation of this method returns "unnamed-format". It is strongly recommended for implementations to give a more meaningful name by overriding this method.
        Specified by:
        formatName in interface FormatValidator
        Returns:
        the format name.