Interface Format

    • Method Detail

      • getName

        String getName()
        Gets the format name.
        Returns:
        the format name as referred to in a json schema format node.
      • getMessageKey

        default String getMessageKey()
        Gets the message key to use for the message.

        See jsv-messages.properties.

        The following are the arguments.
        {0} The instance location
        {1} The format name
        {2} The error message description
        {3} The input value

        Returns:
        the message key
      • getErrorMessageDescription

        @Deprecated
        default String getErrorMessageDescription()
        Deprecated.
        Gets the error message description.

        Deprecated. Override getMessageKey() and set the localized message in the resource bundle or message source.

        Returns:
        the error message description.
      • matches

        default boolean matches​(ExecutionContext executionContext,
                                String value)
        Determines if the value matches the format.

        This should be implemented for string node types.

        Parameters:
        executionContext - the execution context
        value - to match
        Returns:
        true if matches
      • matches

        default boolean matches​(ExecutionContext executionContext,
                                ValidationContext validationContext,
                                String value)
        Determines if the value matches the format.
        Parameters:
        executionContext - the execution context
        validationContext - the validation context
        value - to match
        Returns:
        true if matches
      • matches

        default boolean matches​(ExecutionContext executionContext,
                                ValidationContext validationContext,
                                com.fasterxml.jackson.databind.JsonNode value)
        Determines if the value matches the format.
        Parameters:
        executionContext - the execution context
        validationContext - the validation context
        value - to match
        Returns:
        true if matches
      • matches

        default boolean matches​(ExecutionContext executionContext,
                                ValidationContext validationContext,
                                com.fasterxml.jackson.databind.JsonNode node,
                                com.fasterxml.jackson.databind.JsonNode rootNode,
                                JsonNodePath instanceLocation,
                                boolean assertionsEnabled,
                                FormatValidator formatValidator)
        Determines if the value matches the format.

        This can be implemented for non-string node types.

        Parameters:
        executionContext - the execution context
        validationContext - the validation context
        node - the node
        rootNode - the root node
        instanceLocation - the instance location
        assertionsEnabled - if assertions are enabled
        formatValidator - the format validator
        Returns:
        true if matches
      • validate

        default Set<ValidationMessage> validate​(ExecutionContext executionContext,
                                                ValidationContext validationContext,
                                                com.fasterxml.jackson.databind.JsonNode node,
                                                com.fasterxml.jackson.databind.JsonNode rootNode,
                                                JsonNodePath instanceLocation,
                                                boolean assertionsEnabled,
                                                Supplier<MessageSourceValidationMessage.Builder> message,
                                                FormatValidator formatValidator)
        Validates the format.

        This is the most flexible method to implement.

        Parameters:
        executionContext - the execution context
        validationContext - the validation context
        node - the node
        rootNode - the root node
        instanceLocation - the instance locaiton
        assertionsEnabled - if assertions are enabled
        message - the message builder
        formatValidator - the format validator
        Returns:
        the messages