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 Classes
    Modifier and Type
    Interface
    Description
    static interface 
    This interface is used along with an ExtensionWalker.
  • Method Summary

    Modifier and Type
    Method
    Description
    defaultExtensionModelHelper(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 a ComponentModel within the provided set of ExtensionModels by a ComponentIdentifier.
    org.mule.runtime.api.component.TypedComponentIdentifier.ComponentType
    findComponentType(org.mule.runtime.api.component.ComponentIdentifier componentIdentifier)
    Find a TypedComponentIdentifier.ComponentType for a given ComponentIdentifier
    org.mule.runtime.api.component.TypedComponentIdentifier.ComponentType
    findComponentType(org.mule.runtime.api.meta.model.ComponentModel extensionComponentModel)
    Find a TypedComponentIdentifier.ComponentType for a given ComponentModel
    Optional<org.mule.runtime.api.meta.model.config.ConfigurationModel>
    findConfigurationModel(org.mule.runtime.api.component.ComponentIdentifier componentId)
    Finds a ConfigurationModel within the provided set of ExtensionModels by a ComponentIdentifier.
    Optional<org.mule.metadata.api.model.MetadataType>
    find a MetadataType for a given Java Class.
    org.mule.runtime.extension.api.dsl.syntax.resolver.DslSyntaxResolver
    getDslSyntaxResolverFor(org.mule.runtime.api.meta.model.ExtensionModel extensionModel)
    find the DslSyntaxResolver for the given extensionModel.
    org.mule.runtime.api.meta.type.TypeCatalog
    Returns a TypeCatalog containing all the ObjectTypes available in the current resolving context.
    Optional<org.mule.runtime.api.meta.model.ExtensionModel>
    lookupExtensionModelFor(org.mule.runtime.api.component.ComponentIdentifier componentIdentifier)
    Find a ExtensionModel for a given ComponentIdentifier
    Optional<org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax>
    resolveDslElementModel(org.mule.metadata.api.model.MetadataType type, String namespacePrefix)
    Find a DslElementSyntax for a given MetadataType within the ExtensionModel for 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 a DslElementSyntax for a given MetadataType within the provided ExtensionModel.
    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 a DslElementSyntax for a given ParameterModel with the provided ComponentIdentifier.
    org.mule.runtime.extension.api.dsl.syntax.DslElementSyntax
    resolveDslElementModel(org.mule.runtime.api.meta.NamedObject component, org.mule.runtime.api.component.ComponentIdentifier componentIdentifier)
    Find a DslElementSyntax for a given NamedObject with the provided ComponentIdentifier.
    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!
    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 provided componentIdentifier and calls the corresponding method on the provided delegate when 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 of ExtensionModels to work with. Usually this is the set of models configured within a mule artifact.
      dslResolvingCtx - the DslResolvingContext.
      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 a ConfigurationModel within the provided set of ExtensionModels by a ComponentIdentifier.
      Parameters:
      componentId - the identifier to use for the search.
      Returns:
      the found ConfigurationModel or Optional.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 a ComponentModel within the provided set of ExtensionModels by a ComponentIdentifier.
      Parameters:
      componentId - the identifier to use for the search.
      Returns:
      the found ComponentModel or Optional.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 a TypedComponentIdentifier.ComponentType for a given ComponentIdentifier
      Parameters:
      componentIdentifier - the identifier to use for the search.
      Returns:
      the TypedComponentIdentifier.ComponentType associated with the configuration or an Optional.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 a TypedComponentIdentifier.ComponentType for a given ComponentModel
      Parameters:
      extensionComponentModel - the mode to use for the search.
      Returns:
      the TypedComponentIdentifier.ComponentType associated with the configuration or an Optional.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 a ExtensionModel for a given ComponentIdentifier
      Parameters:
      componentIdentifier - the identifier to use for the search.
      Returns:
      the ExtensionModel associated with the configuration or an Optional.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 a DslElementSyntax for a given MetadataType within the ExtensionModel for 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 DslElementSyntax associated with the type or an Optional.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 a DslElementSyntax for a given MetadataType within the provided ExtensionModel.
      Parameters:
      type - the type to search the syntax for.
      extensionModel - the extension to search in.
      Returns:
      the DslElementSyntax associated with the type or an Optional.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 a DslElementSyntax for a given NamedObject with the provided ComponentIdentifier.
      Parameters:
      component - the component to search the syntax for.
      componentIdentifier - the identifier to use for the search.
      Returns:
      the DslElementSyntax associated 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 a DslElementSyntax for a given ParameterModel with the provided ComponentIdentifier.
      Parameters:
      parameterModel - the parameterModel to search the syntax for.
      componentIdentifier - the identifier to use for the search.
      Returns:
      the DslElementSyntax associated 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 provided componentIdentifier and calls the corresponding method on the provided delegate when found.
      Parameters:
      componentIdentifier - the identifier to use for the search.
      parent - an optional ComponentAstBuilder to disambiguate nested models.
      delegate - the callback to execute on the found model.
      currentExtension - the extension that declares the component with the given componentIdentifier.
    • findMetadataType

      Optional<org.mule.metadata.api.model.MetadataType> findMetadataType(Class<?> type)
      find a MetadataType for a given Java Class.
      Parameters:
      type - the java class to search an associated MetadataType for.
      Returns:
      the MetadataType associated with the Java Class or an Optional.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 a TypeCatalog containing all the ObjectTypes available in the current resolving context.

      Any ObjectType that can be found using the ExtensionModel.getTypes() method for any of the extensions in the context should available in the provided TypeCatalog

      Returns:
      a TypeCatalog containing all the ObjectTypes 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 given extensionModel.
      Parameters:
      extensionModel -
      Returns:
      the dsl syntax for the extensionModel if avialable, Optional.empty() if not.
      Since:
      1.5