Interface IPathFormatter
-
- All Known Implementing Classes:
MetapathFormatter
public interface IPathFormatter
This interface provides an implementation contract for all path formatters. Whenformat(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
Fields Modifier and Type Field Description static IPathFormatter
METAPATH_PATH_FORMATER
A path formatter that produces Metapath-based paths.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default String
format(IPathSegment segment)
Format the path represented by the provided path segment.String
formatAssembly(IAssemblyNodeItem assembly)
This visitor callback is used to format an individual assembly path segment.String
formatDocument(IDocumentNodeItem document)
This visitor callback is used to format an individual document path segment.String
formatField(IFieldNodeItem field)
This visitor callback is used to format an individual field path segment.String
formatFlag(IFlagNodeItem flag)
This visitor callback is used to format an individual flag path segment.String
formatMetaschema(IModuleNodeItem metaschema)
This visitor callback is used to format an individual metaschema path segment.String
formatRootAssembly(IRootAssemblyNodeItem root)
This visitor callback is used to format a root assembly path segment.
-
-
-
Field Detail
-
METAPATH_PATH_FORMATER
@NonNull static final IPathFormatter METAPATH_PATH_FORMATER
A path formatter that produces Metapath-based paths.
-
-
Method Detail
-
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 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:
IPathSegment.getPathStream()
,IPathSegment.getPath()
-
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
-
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
-
-