Interface WalkingDeclarationEnricher
- All Superinterfaces:
DeclarationEnricher
- All Known Implementing Classes:
BackPressureDeclarationEnricher,BooleanParameterDeclarationEnricher,ClusterSupportEnricher,ConfigRefDeclarationEnricher,ConnectionProviderDeclarationEnricher,ContentParameterDeclarationEnricher,DefaultStereotypeEnricher,ErrorMappingsParameterDeclarationEnricher,ExecutionTypeDeclarationEnricher,ExtensionsErrorsDeclarationEnricher,ExtensionTypesDeclarationEnricher,NamedObjectDeclarationEnricher,OAuthDeclarationEnricher,ParameterDslDeclarationEnricher,ParameterLayoutOrderDeclarationEnricher,ReconnectionStrategyDeclarationEnricher,RedeliveryPolicyDeclarationEnricher,StreamingDeclarationEnricher,TargetParameterDeclarationEnricher,TransactionalDeclarationEnricher
Optimization for
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.
- Since:
- 1.5.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classA delegate containing the enrichment logic of aWalkingDeclarationEnricher. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidenrich(ExtensionLoadingContext extensionLoadingContext) Enriches the declaration in theextensionLoadingContextby using aDeclarationWalkerusing the result ofgetWalkDelegate(ExtensionLoadingContext)as a delegate.getWalkDelegate(ExtensionLoadingContext extensionLoadingContext) Optionally returns aWalkingDeclarationEnricher.DeclarationEnricherWalkDelegatethat contains the enrichment logic.Methods inherited from interface org.mule.runtime.extension.api.loader.DeclarationEnricher
getExecutionPhase
-
Method Details
-
enrich
Enriches the declaration in theextensionLoadingContextby using aDeclarationWalkerusing the result ofgetWalkDelegate(ExtensionLoadingContext)as a delegate. If said method returns anOptional.empty()then nothing is done.WalkingDeclarationEnricher.DeclarationEnricherWalkDelegate.onWalkFinished()is invoked in compliance with the delegate's contract.- Specified by:
enrichin interfaceDeclarationEnricher- Parameters:
extensionLoadingContext- aExtensionLoadingContext
-
getWalkDelegate
Optional<WalkingDeclarationEnricher.DeclarationEnricherWalkDelegate> getWalkDelegate(ExtensionLoadingContext extensionLoadingContext) Optionally returns aWalkingDeclarationEnricher.DeclarationEnricherWalkDelegatethat 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- Parameters:
extensionLoadingContext- aExtensionLoadingContext- Returns:
- an optional delegate
-