public interface WalkingDeclarationEnricher extends DeclarationEnricher
enrichers which would normally use a DeclarationEnricher to implement
their logic, a pattern we found to be quite common. This results in several "walks"s; being performed over the
declaration, which becomes computationally expensive.
This interface allows to optimize that by extracting the performed logic to the
getWalkDelegate(ExtensionLoadingContext) method, which gives Mule the ability to reduce the number of walks necessary
to perform the enrichment.
This interface still adheres to the DeclarationEnricher contract and thus the enrich(ExtensionLoadingContext)
method must still work, but delegating to the WalkingDeclarationEnricher.DeclarationEnricherWalkDelegate returned by the
getWalkDelegate(ExtensionLoadingContext) method.
| Modifier and Type | Interface and Description |
|---|---|
static class |
WalkingDeclarationEnricher.DeclarationEnricherWalkDelegate
A delegate containing the enrichment logic of a
WalkingDeclarationEnricher. |
| Modifier and Type | Method and Description |
|---|---|
default void |
enrich(ExtensionLoadingContext extensionLoadingContext)
Enriches the declaration in the
extensionLoadingContext by using a DeclarationWalker using the result of
getWalkDelegate(ExtensionLoadingContext) as a delegate. |
Optional<WalkingDeclarationEnricher.DeclarationEnricherWalkDelegate> |
getWalkDelegate(ExtensionLoadingContext extensionLoadingContext)
Optionally returns a
WalkingDeclarationEnricher.DeclarationEnricherWalkDelegate that contains the enrichment logic. |
getExecutionPhasedefault void enrich(ExtensionLoadingContext extensionLoadingContext)
extensionLoadingContext by using a DeclarationWalker using the result of
getWalkDelegate(ExtensionLoadingContext) as a delegate. If said method returns an Optional.empty() then
nothing is done. WalkingDeclarationEnricher.DeclarationEnricherWalkDelegate.onWalkFinished() is invoked in compliance with the delegate's
contract.enrich in interface DeclarationEnricherextensionLoadingContext - a ExtensionLoadingContextOptional<WalkingDeclarationEnricher.DeclarationEnricherWalkDelegate> getWalkDelegate(ExtensionLoadingContext extensionLoadingContext)
WalkingDeclarationEnricher.DeclarationEnricherWalkDelegate that contains the enrichment logic.
If Optional.empty() is returned, it means that this enricher does not apply to the given declaration and it should be
skipped
extensionLoadingContext - a ExtensionLoadingContextCopyright © 2023 MuleSoft, Inc.. All rights reserved.