You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Guillaume Nodet (Jira)" <ji...@apache.org> on 2026/05/05 09:20:00 UTC

[jira] [Closed] (CAMEL-23412) Add getChildren() to NamedNode for uniform model tree traversal

     [ https://issues.apache.org/jira/browse/CAMEL-23412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet closed CAMEL-23412.
-----------------------------------
    Resolution: Fixed

> Add getChildren() to NamedNode for uniform model tree traversal
> ---------------------------------------------------------------
>
>                 Key: CAMEL-23412
>                 URL: https://issues.apache.org/jira/browse/CAMEL-23412
>             Project: Camel
>          Issue Type: Improvement
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>            Priority: Major
>             Fix For: 4.21.0
>
>
> h2. Problem
> ChoiceDefinition's when/otherwise children are invisible to generic model tree walkers because getOutputs() returns List<ProcessorDefinition<?>> and neither WhenDefinition nor OtherwiseDefinition extends ProcessorDefinition. This forces every tree walker to special-case ChoiceDefinition — and several don't, creating gaps (e.g., gatherAllNodeIds() misses when/otherwise node IDs, forceAssignIds() skips them).
> CAMEL-23402 switched the structure dumper from JMX-based to model-walking and added the missing OtherwiseDefinition to doFindType()'s special case. However, it did not address the fundamental design issue: every new tree walker must know to add the ChoiceDefinition special case, and the existing ones that don't have it silently miss when/otherwise nodes.
> h2. Solution
> Add a getChildren() default method on NamedNode that returns List<NamedNode>, providing a uniform API for tree traversal regardless of whether children are ProcessorDefinition subclasses or not.
> This eliminates the ChoiceDefinition and TryDefinition special cases from ProcessorDefinitionHelper.doFindType() (reducing ~110 lines to ~15 lines) and fixes the gaps in gatherAllNodeIds(), resetAllAutoAssignedNodeIds(), and forceAssignIds().



--
This message was sent by Atlassian Jira
(v8.20.10#820010)