Package com.apicatalog.tree.io


package com.apicatalog.tree.io
Provides a flexible, format-agnostic framework for processing tree-like data structures. This package is designed to decouple data processing logic from any specific data format (e.g., JSON, YAML, CBOR) or underlying implementation library.

Core Design

The framework is built upon three primary abstractions that work in concert to enable data transformation workflows:
  1. TreeAdapter: The Reader
    Acts as a read-only "view" over a native tree structure. It translates a specific format into a generic interface that the rest of the framework can understand.
  2. TreeGenerator: The Writer
    Provides a write-only, streaming API for serializing a tree structure. It abstracts the destination, which could be anything from a file on disk to an in-memory object model.
  3. TreeTraversal: The Engine
    A stateful, non-recursive iterator that traverses the structure exposed by a TreeAdapter and drives a TreeGenerator. It is the engine that connects a source to a destination.

Key Features

  • Format-Agnostic: Write processing logic once and apply it to any data format for which a NodeAdapter exists.
  • Decoupled: Application logic does not need to depend on any specific data-binding library.
  • Non-Recursive Traversal: The NodeVisitor uses an iterative, stack-based approach, making it safe for processing very large or deeply nested documents without risking a StackOverflowError.
  • Extensible: Support for new data formats can be added by implementing the core interfaces.
  • Class
    Description
     
    Enumeration of supported node types within a PolyMorph tree structure.
    Provides a uniform, read-only abstraction for navigating tree-like data structures.
    Provides a uniform, event-based abstraction for constructing tree-like data structures.
    Immutable representation of a tree node where the node and its descendants are accessed through a TreeAdapter.
    Exception thrown when a node cannot be read, written, or generated by a NodeReader, NodeWriter, or NodeGenerator.
     
     
    Provides a stateful, non-recursive, depth-first iterator for arbitrary tree-like structures.
    Identifies the role of the current node within the tree structure during traversal.