public final class MuleArtifactAstCopyUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static ComponentAst |
copyComponentTreeRecursively(ComponentAst source,
UnaryOperator<ComponentAst> componentMapper)
Copies and transforms a given
ComponentAst, mapping it and its children ComponentAst instances recursively
with the provided compoenentMapper function. |
static ArtifactAst |
copyRecursively(ArtifactAst source,
UnaryOperator<ComponentAst> componentMapper)
Copies and transforms a given
ArtifactAst, mapping its internal ComponentAst instances with the provided
compoenentMapper function. |
static ArtifactAst |
copyRecursively(ArtifactAst source,
UnaryOperator<ComponentAst> componentMapper,
Supplier<List<ComponentAst>> topLeveltoAdd,
Predicate<ComponentAst> topLevelToRemove)
Copies and transforms a given
ArtifactAst, mapping its internal ComponentAst instances with the provided
compoenentMapper function. |
public static ArtifactAst copyRecursively(ArtifactAst source, UnaryOperator<ComponentAst> componentMapper)
ArtifactAst, mapping its internal ComponentAst instances with the provided
compoenentMapper function.source - the ArtifactAst to copy and transform.componentMapper - transformation to apply to each ComponentAst from source. If no transformation is to
be done for a given ComponentAst, the same instance must be returned.source AST.public static ArtifactAst copyRecursively(ArtifactAst source, UnaryOperator<ComponentAst> componentMapper, Supplier<List<ComponentAst>> topLeveltoAdd, Predicate<ComponentAst> topLevelToRemove)
ArtifactAst, mapping its internal ComponentAst instances with the provided
compoenentMapper function.
This method also allows for adding or removing top level elements from the transformed AST.
In the case that for a newly added component, topLevelToRemove returns true, that component will NOT be on
the returned AST.
source - the ArtifactAst to copy and transform.componentMapper - transformation to apply to each ComponentAst from source. If no transformation is to
be done for a given ComponentAst, the same instance must be returned.topLeveltoAdd - components to be added as top-level elements in the transformed ASTtopLevelToRemove - any top-level elements for which this returns true will be removed from the returned AST.source AST.public static ComponentAst copyComponentTreeRecursively(ComponentAst source, UnaryOperator<ComponentAst> componentMapper)
ComponentAst, mapping it and its children ComponentAst instances recursively
with the provided compoenentMapper function.source - the ComponentAst to copy and transform recursively.componentMapper - transformation to apply to each ComponentAst from source. If no transformation is to
be done for a given ComponentAst, the same instance must be returned.source AST.Copyright © 2022 MuleSoft, Inc.. All rights reserved.