Package org.mule.runtime.ast.api.model
Interface ExtensionModelHelper
- All Known Implementing Classes:
DefaultExtensionModelHelper
public interface ExtensionModelHelper
Helper class to work with a set of
ExtensionModels
Contains a cache for searches within the extension models so we avoid processing each extension model twice.
It's recommended that the application only has one instance of this class to avoid processing the extension models several times.
- Since:
- 1.4
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThis interface is used along with an ExtensionWalker. -
Method Summary
Modifier and TypeMethodDescriptionstatic ExtensionModelHelperdefaultExtensionModelHelper(Set<org.mule.runtime.api.meta.model.ExtensionModel> extensionModels, org.mule.runtime.api.dsl.DslResolvingContext dslResolvingCtx) Optional<org.mule.runtime.api.meta.model.ComponentModel>findComponentModel(org.mule.runtime.api.component.ComponentIdentifier componentId) Finds aComponentModelwithin the provided set ofExtensionModels by aComponentIdentifier.org.mule.runtime.api.component.TypedComponentIdentifier.ComponentTypefindComponentType(org.mule.runtime.api.component.ComponentIdentifier componentIdentifier) Find aTypedComponentIdentifier.ComponentTypefor a givenComponentIdentifierorg.mule.runtime.api.component.TypedComponentIdentifier.ComponentTypefindComponentType(org.mule.runtime.api.meta.model.ComponentModel extensionComponentModel) Find aTypedComponentIdentifier.ComponentTypefor a givenComponentModelOptional<org.mule.runtime.api.meta.model.config.ConfigurationModel>findConfigurationModel(org.mule.runtime.api.component.ComponentIdentifier componentId) Finds aConfigurationModelwithin the provided set ofExtensionModels by aComponentIdentifier.Optional<org.mule.metadata.api.model.MetadataType>findMetadataType(Class<?> type) find aMetadataTypefor a given JavaClass.org.mule.runtime.extension.api.dsl.syntax.resolver.DslSyntaxResolvergetDslSyntaxResolverFor(org.mule.runtime.api.meta.model.ExtensionModel extensionModel) find the DslSyntaxResolver for the givenextensionModel.org.mule.runtime.api.meta.type.TypeCatalogReturns aTypeCatalogcontaining all theObjectTypes available in the current resolving context.Optional<org.mule.runtime.api.meta.model.ExtensionModel>lookupExtensionModelFor(org.mule.runtime.api.component.ComponentIdentifier componentIdentifier) Find aExtensionModelfor a givenComponentIdentifierOptional<org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax>resolveDslElementModel(org.mule.metadata.api.model.MetadataType type, String namespacePrefix) Find aDslElementSyntaxfor a givenMetadataTypewithin theExtensionModelfor the provided namespace prefix.Optional<org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax>resolveDslElementModel(org.mule.metadata.api.model.MetadataType type, org.mule.runtime.api.meta.model.ExtensionModel extensionModel) Find aDslElementSyntaxfor a givenMetadataTypewithin the providedExtensionModel.org.mule.runtime.extension.api.dsl.syntax.DslElementSyntaxresolveDslElementModel(org.mule.runtime.api.meta.model.parameter.ParameterModel parameterModel, org.mule.runtime.api.component.ComponentIdentifier componentIdentifier) Find aDslElementSyntaxfor a givenParameterModelwith the providedComponentIdentifier.org.mule.runtime.extension.api.dsl.syntax.DslElementSyntaxresolveDslElementModel(org.mule.runtime.api.meta.NamedObject component, org.mule.runtime.api.component.ComponentIdentifier componentIdentifier) Find aDslElementSyntaxfor a givenNamedObjectwith the providedComponentIdentifier.Map<org.mule.metadata.api.model.ObjectType,Optional<org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax>> resolveSubTypes(org.mule.metadata.api.model.ObjectType type) Note: Only instantiable subtypes will be returned by this method!voidwalkToComponent(org.mule.runtime.api.component.ComponentIdentifier componentIdentifier, Optional<ComponentAstBuilder> parent, ExtensionModelHelper.ExtensionWalkerModelDelegate delegate, org.mule.runtime.api.meta.model.ExtensionModel currentExtension) Navigates the extension model for the providedcomponentIdentifierand calls the corresponding method on the provideddelegatewhen found.
-
Method Details
-
defaultExtensionModelHelper
static ExtensionModelHelper defaultExtensionModelHelper(Set<org.mule.runtime.api.meta.model.ExtensionModel> extensionModels, org.mule.runtime.api.dsl.DslResolvingContext dslResolvingCtx) - Parameters:
extensionModels- the set ofExtensionModels to work with. Usually this is the set of models configured within a mule artifact.dslResolvingCtx- theDslResolvingContext.- Returns:
- the default implementation of an
ExtensionModelHelper.
-
findConfigurationModel
Optional<org.mule.runtime.api.meta.model.config.ConfigurationModel> findConfigurationModel(org.mule.runtime.api.component.ComponentIdentifier componentId) Finds aConfigurationModelwithin the provided set ofExtensionModels by aComponentIdentifier.- Parameters:
componentId- the identifier to use for the search.- Returns:
- the found
ConfigurationModelorOptional.empty()if it couldn't be found.
-
findComponentModel
Optional<org.mule.runtime.api.meta.model.ComponentModel> findComponentModel(org.mule.runtime.api.component.ComponentIdentifier componentId) Finds aComponentModelwithin the provided set ofExtensionModels by aComponentIdentifier.- Parameters:
componentId- the identifier to use for the search.- Returns:
- the found
ComponentModelorOptional.empty()if it couldn't be found. - Since:
- 1.5
-
findComponentType
org.mule.runtime.api.component.TypedComponentIdentifier.ComponentType findComponentType(org.mule.runtime.api.component.ComponentIdentifier componentIdentifier) Find aTypedComponentIdentifier.ComponentTypefor a givenComponentIdentifier- Parameters:
componentIdentifier- the identifier to use for the search.- Returns:
- the
TypedComponentIdentifier.ComponentTypeassociated with the configuration or anOptional.empty()if there isn't one. - Since:
- 1.5
-
findComponentType
org.mule.runtime.api.component.TypedComponentIdentifier.ComponentType findComponentType(org.mule.runtime.api.meta.model.ComponentModel extensionComponentModel) Find aTypedComponentIdentifier.ComponentTypefor a givenComponentModel- Parameters:
extensionComponentModel- the mode to use for the search.- Returns:
- the
TypedComponentIdentifier.ComponentTypeassociated with the configuration or anOptional.empty()if there isn't one. - Since:
- 1.5
-
lookupExtensionModelFor
Optional<org.mule.runtime.api.meta.model.ExtensionModel> lookupExtensionModelFor(org.mule.runtime.api.component.ComponentIdentifier componentIdentifier) Find aExtensionModelfor a givenComponentIdentifier- Parameters:
componentIdentifier- the identifier to use for the search.- Returns:
- the
ExtensionModelassociated with the configuration or anOptional.empty()if there isn't one. - Since:
- 1.5
-
resolveDslElementModel
Optional<org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax> resolveDslElementModel(org.mule.metadata.api.model.MetadataType type, String namespacePrefix) Find aDslElementSyntaxfor a givenMetadataTypewithin theExtensionModelfor the provided namespace prefix.- Parameters:
type- the type to search the syntax for.namespacePrefix- the namespace prefix of the extension to search in.- Returns:
- the
DslElementSyntaxassociated with the type or anOptional.empty()if there isn't one. - Since:
- 1.5
-
resolveDslElementModel
Optional<org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax> resolveDslElementModel(org.mule.metadata.api.model.MetadataType type, org.mule.runtime.api.meta.model.ExtensionModel extensionModel) Find aDslElementSyntaxfor a givenMetadataTypewithin the providedExtensionModel.- Parameters:
type- the type to search the syntax for.extensionModel- the extension to search in.- Returns:
- the
DslElementSyntaxassociated with the type or anOptional.empty()if there isn't one. - Since:
- 1.5
-
resolveDslElementModel
org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax resolveDslElementModel(org.mule.runtime.api.meta.NamedObject component, org.mule.runtime.api.component.ComponentIdentifier componentIdentifier) Find aDslElementSyntaxfor a givenNamedObjectwith the providedComponentIdentifier.- Parameters:
component- the component to search the syntax for.componentIdentifier- the identifier to use for the search.- Returns:
- the
DslElementSyntaxassociated with the component. - Since:
- 1.5
-
resolveDslElementModel
org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax resolveDslElementModel(org.mule.runtime.api.meta.model.parameter.ParameterModel parameterModel, org.mule.runtime.api.component.ComponentIdentifier componentIdentifier) Find aDslElementSyntaxfor a givenParameterModelwith the providedComponentIdentifier.- Parameters:
parameterModel- the parameterModel to search the syntax for.componentIdentifier- the identifier to use for the search.- Returns:
- the
DslElementSyntaxassociated with the parameterModel. - Since:
- 1.5
-
walkToComponent
void walkToComponent(org.mule.runtime.api.component.ComponentIdentifier componentIdentifier, Optional<ComponentAstBuilder> parent, ExtensionModelHelper.ExtensionWalkerModelDelegate delegate, org.mule.runtime.api.meta.model.ExtensionModel currentExtension) Navigates the extension model for the providedcomponentIdentifierand calls the corresponding method on the provideddelegatewhen found.- Parameters:
componentIdentifier- the identifier to use for the search.parent- an optionalComponentAstBuilderto disambiguate nested models.delegate- the callback to execute on the found model.currentExtension- the extension that declares the component with the givencomponentIdentifier.
-
findMetadataType
find aMetadataTypefor a given JavaClass.- Parameters:
type- the java class to search an associatedMetadataTypefor.- Returns:
- the
MetadataTypeassociated with the JavaClassor anOptional.empty()if there isn't one. - Since:
- 1.5
-
resolveSubTypes
Map<org.mule.metadata.api.model.ObjectType,Optional<org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax>> resolveSubTypes(org.mule.metadata.api.model.ObjectType type) Note: Only instantiable subtypes will be returned by this method!- Parameters:
type- the type to resolve subtypes for- Returns:
- the subtypes along with their
DslElementSyntax, if available. - Since:
- 1.5
-
getTypeCatalog
org.mule.runtime.api.meta.type.TypeCatalog getTypeCatalog()Returns aTypeCatalogcontaining all theObjectTypes available in the current resolving context.Any
ObjectTypethat can be found using theExtensionModel.getTypes()method for any of theextensionsin the context should available in the providedTypeCatalog- Returns:
- a
TypeCatalogcontaining all theObjectTypes available in the current resolving context. - Since:
- 1.5
-
getDslSyntaxResolverFor
org.mule.runtime.extension.api.dsl.syntax.resolver.DslSyntaxResolver getDslSyntaxResolverFor(org.mule.runtime.api.meta.model.ExtensionModel extensionModel) find the DslSyntaxResolver for the givenextensionModel.- Parameters:
extensionModel-- Returns:
- the dsl syntax for the
extensionModelif avialable,Optional.empty()if not. - Since:
- 1.5
-