Interface IPathFormatter

All Known Implementing Classes:
JsonPointerFormatter, MetapathFormatter, XPathFormatter

public interface IPathFormatter
This interface provides an implementation contract for all path formatters. When format(IPathSegment) is called on a formatter implementation, the formatter will render the path segments based on the implemented path syntax. This allows a collection of path segments to be rendered in different forms by swapping out the formatter used. A path formatter is expected to be stateless and thus thread safe.
  • Field Details

    • METAPATH_PATH_FORMATER

      @NonNull static final IPathFormatter METAPATH_PATH_FORMATER
      A path formatter that produces Metapath-based paths.
    • XPATH_PATH_FORMATTER

      @NonNull static final IPathFormatter XPATH_PATH_FORMATTER
      A path formatter that produces XPath 3.1 paths with EQName-qualified names.

      This formatter generates namespace-qualified paths using the EQName format (e.g., Q{http://example.com}element[1]), suitable for use with XML tooling that requires namespace qualification.

      See Also:
    • JSON_POINTER_PATH_FORMATTER

      @NonNull static final IPathFormatter JSON_POINTER_PATH_FORMATTER
      A path formatter that produces RFC 6901 JSON Pointer paths.

      This formatter generates JSON Pointer paths suitable for use with JSON tooling and JSON-based error reporting. Uses JSON property names, 0-based array indices, and proper RFC 6901 escaping.

      See Also:
  • Method Details

    • format

      @NonNull default String format(@NonNull IPathSegment segment)
      Format the path represented by the provided path segment. The provided segment is expected to be the last node in this path. A call to IPathSegment.getPathStream() or IPathSegment.getPath() can be used to walk the path tree in descending order.
      Parameters:
      segment - The last segment in a sequence of path segments
      Returns:
      a formatted path
      See Also:
    • formatFlag

      @NonNull String formatFlag(@NonNull IFlagNodeItem flag)
      This visitor callback is used to format an individual flag path segment.
      Parameters:
      flag - the node to format
      Returns:
      the formatted text for the segment
    • formatField

      @NonNull String formatField(@NonNull IFieldNodeItem field)
      This visitor callback is used to format an individual field path segment.
      Parameters:
      field - the node to format
      Returns:
      the formatted text for the segment
    • formatAssembly

      @NonNull String formatAssembly(@NonNull IAssemblyNodeItem assembly)
      This visitor callback is used to format an individual assembly path segment.
      Parameters:
      assembly - the node to format
      Returns:
      the formatted text for the segment
    • formatAssembly

      @NonNull String formatAssembly(@NonNull IAssemblyInstanceGroupedNodeItem assembly)
      This visitor callback is used to format an individual grouped assembly path segment.
      Parameters:
      assembly - the node to format
      Returns:
      the formatted text for the segment
    • formatRootAssembly

      @NonNull String formatRootAssembly(@NonNull IRootAssemblyNodeItem root)
      This visitor callback is used to format a root assembly path segment.
      Parameters:
      root - the node to format
      Returns:
      the formatted text for the segment
    • formatDocument

      @NonNull String formatDocument(@NonNull IDocumentNodeItem document)
      This visitor callback is used to format an individual document path segment.
      Parameters:
      document - the node to format
      Returns:
      the formatted text for the segment
    • formatMetaschema

      @NonNull String formatMetaschema(@NonNull IModuleNodeItem metaschema)
      This visitor callback is used to format an individual metaschema path segment.
      Parameters:
      metaschema - the node to format
      Returns:
      the formatted text for the segment