- 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 Summary
FieldsModifier and TypeFieldDescriptionstatic final IPathFormatterA path formatter that produces RFC 6901 JSON Pointer paths.static final IPathFormatterA path formatter that produces Metapath-based paths.static final IPathFormatterA path formatter that produces XPath 3.1 paths with EQName-qualified names. -
Method Summary
Modifier and TypeMethodDescriptiondefault Stringformat(IPathSegment segment) Format the path represented by the provided path segment.This visitor callback is used to format an individual grouped assembly path segment.formatAssembly(IAssemblyNodeItem assembly) This visitor callback is used to format an individual assembly path segment.formatDocument(IDocumentNodeItem document) This visitor callback is used to format an individual document path segment.formatField(IFieldNodeItem field) This visitor callback is used to format an individual field path segment.formatFlag(IFlagNodeItem flag) This visitor callback is used to format an individual flag path segment.formatMetaschema(IModuleNodeItem metaschema) This visitor callback is used to format an individual metaschema path segment.This visitor callback is used to format a root assembly path segment.
-
Field Details
-
METAPATH_PATH_FORMATER
A path formatter that produces Metapath-based paths. -
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
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
Format the path represented by the provided path segment. The provided segment is expected to be the last node in this path. A call toIPathSegment.getPathStream()orIPathSegment.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
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
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
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
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
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
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
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
-