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 format name
        {1} The input value

        Note that the default localized messages do not use the input value.

        Returns:
        the message key
      • 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,
                                SchemaContext schemaContext,
                                String value)
        Determines if the value matches the format.
        Parameters:
        executionContext - the execution context
        schemaContext - the schema context
        value - to match
        Returns:
        true if matches
      • matches

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

        default boolean matches​(ExecutionContext executionContext,
                                SchemaContext schemaContext,
                                com.fasterxml.jackson.databind.JsonNode node,
                                com.fasterxml.jackson.databind.JsonNode rootNode,
                                NodePath 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
        schemaContext - the schema 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 void validate​(ExecutionContext executionContext,
                              SchemaContext schemaContext,
                              com.fasterxml.jackson.databind.JsonNode node,
                              com.fasterxml.jackson.databind.JsonNode rootNode,
                              NodePath instanceLocation,
                              boolean assertionsEnabled,
                              Supplier<MessageSourceError.Builder> message,
                              FormatValidator formatValidator)
        Validates the format.

        This is the most flexible method to implement.

        Parameters:
        executionContext - the execution context
        schemaContext - the schema 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