Class JavaPackage
- All Implemented Interfaces:
Serializable
This class handles the logical grouping of Java types and is responsible for rendering the package header with the 📦 icon and managing the summarized view of its contents.
- Author:
- Anahata
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<ProjectComponent> The list of top-level Java components (types) contained within this package.private StringThe fully qualified name of the Java package. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComponent(ProjectComponent component) Adds a top-level Java component to this package.longCalculates the total recursive size of this node and all its descendants.voidrenderMarkdown(StringBuilder sb, String indent, boolean summary) Renders the node and its children into a Markdown representation.
-
Field Details
-
name
The fully qualified name of the Java package. -
components
The list of top-level Java components (types) contained within this package.
-
-
Constructor Details
-
JavaPackage
public JavaPackage()
-
-
Method Details
-
addComponent
Adds a top-level Java component to this package.- Parameters:
component- The component to add.
-
getTotalSize
public long getTotalSize()Calculates the total recursive size of this node and all its descendants.Implementation details: This method must perform a deep traversal of the subtree rooted at this node, summing the sizes of all constituent physical files or logical components to provide an accurate total byte count for the branch.
Implementation details: Iterates through all registered components and sums their results from
ProjectComponent.getTotalSize().- Specified by:
getTotalSizein classProjectNode- Returns:
- The total size in bytes.
-
renderMarkdown
Renders the node and its children into a Markdown representation.Implementation details: The renderer must strictly honor the 'summary' flag. In summary mode, it should only output aggregate totals for the node. In standard mode, it must perform a hierarchical traversal, using indentation to represent nesting depth and specialized icons to denote node types.
Implementation details: 1. Renders the package name prefixed with the 📦 icon. 2. In 'summary' mode, appends aggregate totals by component type (e.g. 2 CLASS, 1 png) and size. 3. In standard mode, sorts components (ensuring package-info is first) and recursively triggers their rendering logic.
- Specified by:
renderMarkdownin classProjectNode- Parameters:
sb- The target StringBuilder to append the Markdown to.indent- The current indentation string (e.g., " ") for nesting level.summary- If true, renders only the condensed/aggregate view.
-

