public final class MuleAstUtils extends Object
ArtifactAsts and ComponentAsts.| Modifier and Type | Method and Description |
|---|---|
static void |
doOnParamComponents(ComponentParameterAst param,
Consumer<ComponentAst> action)
Performs a given action on the
ComponentAsts that form the value of the provided parameter. |
static ArtifactAst |
emptyArtifact()
Provides a singleton empty
ArtifactAst instance. |
static Optional<ComponentParameterAst> |
parameterOfType(ComponentAst referent,
org.mule.runtime.api.meta.model.stereotype.StereotypeModel referenceStereotype)
Given a
ComponentAst, lookup for a parameter that references an object with a certain stereotype. |
static List<ComponentParameterAst> |
parametersOfType(ComponentAst referent,
org.mule.runtime.api.meta.model.stereotype.StereotypeModel referenceStereotype)
Given a
ComponentAst, lookup for all parameters that reference an object with a certain stereotype. |
static Stream<org.mule.runtime.api.util.Pair<ComponentAst,List<ComponentAst>>> |
recursiveStreamWithHierarchy(ArtifactAst artifact)
Similar to
ArtifactAst.recursiveStream(), but it enhances the Stream by adding hierarchy context to each
item. |
static Stream<org.mule.runtime.api.util.Pair<ComponentAst,List<ComponentAst>>> |
recursiveStreamWithHierarchy(ArtifactAst artifact,
AstTraversalDirection direction)
Similar to
ArtifactAst.recursiveStream(), but it enhances the Stream by adding hierarchy context to each
item. |
static Stream<org.mule.runtime.api.util.Pair<ComponentAst,List<ComponentAst>>> |
recursiveStreamWithHierarchy(ArtifactAst artifact,
AstTraversalDirection direction,
boolean ignoreParameterComplexValues)
Similar to
ArtifactAst.recursiveStream(), but it enhances the Stream by adding hierarchy context to each
item. |
static Set<ComponentAst> |
resolveOrphanComponents(ArtifactAst appModel)
Given an
ArtifactAst, return all those components within it that are not accessible from a top-level component. |
static ValidationResult |
validate(ArtifactAst artifact)
Runs all validations available from the current
Thread.getContextClassLoader(). |
static ValidationResult |
validate(ArtifactAst artifact,
Predicate<Validation> validationsFilter)
Runs all validations available from the current
Thread.getContextClassLoader(). |
public static Set<ComponentAst> resolveOrphanComponents(ArtifactAst appModel)
ArtifactAst, return all those components within it that are not accessible from a top-level component.appModel - the model to determine orphan components from.appModel that are not accessible from a top-level component.public static ArtifactAst emptyArtifact()
ArtifactAst instance.ArtifactAst without components.public static Optional<ComponentParameterAst> parameterOfType(ComponentAst referent, org.mule.runtime.api.meta.model.stereotype.StereotypeModel referenceStereotype)
ComponentAst, lookup for a parameter that references an object with a certain stereotype.referent - the ComponentAst that will be checked for the reference.referenceStereotype - the StereotypeModel to check for.ComponentParameterAst representing a parameter of referent that references an object assignable
to referenceStereotype, if it exists.public static List<ComponentParameterAst> parametersOfType(ComponentAst referent, org.mule.runtime.api.meta.model.stereotype.StereotypeModel referenceStereotype)
ComponentAst, lookup for all parameters that reference an object with a certain stereotype.referent - the ComponentAst that will be checked for the reference.referenceStereotype - the StereotypeModel to check for.ComponentParameterAsts representing parameters of referent that reference an object assignable to
referenceStereotype.public static void doOnParamComponents(ComponentParameterAst param, Consumer<ComponentAst> action)
ComponentAsts that form the value of the provided parameter.param - the parameter on which complex parameter values the action will be called.action - the callback to perform on each found parameter item.public static Stream<org.mule.runtime.api.util.Pair<ComponentAst,List<ComponentAst>>> recursiveStreamWithHierarchy(ArtifactAst artifact)
ArtifactAst.recursiveStream(), but it enhances the Stream by adding hierarchy context to each
item. The ArtifactAst is traversed in TOP_DOWN direction.
The elements of the Stream are Pairs:
ArtifactAst.recursiveStream().artifact - the ArtifactAst to generate a Stream for.Stream with hierarchy context.public static Stream<org.mule.runtime.api.util.Pair<ComponentAst,List<ComponentAst>>> recursiveStreamWithHierarchy(ArtifactAst artifact, AstTraversalDirection direction)
ArtifactAst.recursiveStream(), but it enhances the Stream by adding hierarchy context to each
item. The ArtifactAst is traversed in AstTraversalDirection direction
The elements of the Stream are Pairs:
ArtifactAst.recursiveStream().artifact - the ArtifactAst to generate a Stream for.direction - the AstTraversalDirection used to navigate the artifact.ignoreParameterComplexValues - whether the returned Stream will contain any complex values in component
parameters.Stream with hierarchy context.public static Stream<org.mule.runtime.api.util.Pair<ComponentAst,List<ComponentAst>>> recursiveStreamWithHierarchy(ArtifactAst artifact, AstTraversalDirection direction, boolean ignoreParameterComplexValues)
ArtifactAst.recursiveStream(), but it enhances the Stream by adding hierarchy context to each
item. The ArtifactAst is traversed in AstTraversalDirection direction
The elements of the Stream are Pairs:
ArtifactAst.recursiveStream().artifact - the ArtifactAst to generate a Stream for.direction - the AstTraversalDirection used to navigate the artifact.ignoreParameterComplexValues - whether the returned Stream will contain any complex values in component
parameters.Stream with hierarchy context.public static ValidationResult validate(ArtifactAst artifact)
Thread.getContextClassLoader().
All validations will be run even if failures are found in some. The result will contain all failures.
artifact - the artifact to validatepublic static ValidationResult validate(ArtifactAst artifact, Predicate<Validation> validationsFilter)
Thread.getContextClassLoader().
All validations will be run even if failures are found in some. The result will contain all failures.
artifact - the artifact to validatevalidationsFilter - additional filter to apply on the discovered validations before evaluating them.Copyright © 2025 MuleSoft, Inc.. All rights reserved.