Class ComponentBuildingDefinition.Builder<T>

java.lang.Object
org.mule.runtime.dsl.api.component.ComponentBuildingDefinition.Builder<T>
Enclosing class:
ComponentBuildingDefinition<T>

public static class ComponentBuildingDefinition.Builder<T> extends Object
Builder for ComponentBuildingDefinition

  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • withConstructorParameterDefinition

      public ComponentBuildingDefinition.Builder<T> withConstructorParameterDefinition(AttributeDefinition attributeDefinition)
      Adds a new constructor parameter to be used during the object instantiation.
      Parameters:
      attributeDefinition - the constructor argument definition.
      Returns:
      a copy of this builder
    • withSetterParameterDefinition

      public ComponentBuildingDefinition.Builder<T> withSetterParameterDefinition(String fieldName, AttributeDefinition attributeDefinition)
      Adds a new parameter to be added to the object by using a setter method.
      Parameters:
      fieldName - the name of the field in which the value must be injected
      attributeDefinition - the setter parameter definition
      Returns:
      a copy of this builder
    • withIdentifier

      public ComponentBuildingDefinition.Builder<T> withIdentifier(String identifier)
      Sets the identifier of the configuration element that this building definition is for. For instance, a config element <http:listener> has as identifier listener
      Parameters:
      identifier - configuration element identifier
      Returns:
      a copy of this builder
    • withNamespace

      public ComponentBuildingDefinition.Builder<T> withNamespace(String namespace)
      Sets the namespace of the configuration element that this building definition is for. For instance, a config element <http:listener> has as namespace http
      Parameters:
      namespace - configuration element namespace
      Returns:
      a copy of this builder
    • withTypeDefinition

      public ComponentBuildingDefinition.Builder<T> withTypeDefinition(TypeDefinition<T> typeDefinition)
      Sets the TypeDefinition to discover the object type. It may be created from TypeDefinition.fromType(Class) which means the type is predefined. Or it may be created from TypeDefinition.fromConfigurationAttribute(String) which means that the object type is declared within the configuration using a config attribute.
      Parameters:
      typeDefinition - the type definition to discover the object type
      Returns:
      a copy of this builder
    • withTypeConverter

      public ComponentBuildingDefinition.Builder<T> withTypeConverter(TypeConverter typeConverter)
      This method allows to convert a simple type to another type using a converter. TypeConverter are only allowed when the produce type by the component is any of java primitive types, its wrapper or string.
      Parameters:
      typeConverter - converter from the configuration value to a custom type.
      Returns:
      a copy of this builder
    • withKeyTypeConverter

      public ComponentBuildingDefinition.Builder<T> withKeyTypeConverter(TypeConverter typeConverter)
      This method allows to convert a map entry key to another type using a converter. TypeConverter are only allowed when the produce type by the component is any of java primitive types, its wrapper or string.
      Parameters:
      typeConverter - converter from the configuration value to a custom type.
      Returns:
      a copy of this builder
    • alwaysEnabled

      @Deprecated public ComponentBuildingDefinition.Builder<T> alwaysEnabled(boolean value)
      Deprecated.
      since 4.4. No longer used. stereotypes are used to determine this.
      This method configures the component as enabled even if excluded from a partial application model (for instance when building one for data sense).
      Parameters:
      value - boolean indicating if the component should be always enabled
      Returns:
      a copy of $this builder
    • withRegistrationName

      public ComponentBuildingDefinition.Builder<T> withRegistrationName(String name)
      Set the component name that will appear in the registry. This is intended for top level singletons without a name attribute, as there will be an error if more than one element of this type is used.
      Parameters:
      name - the component name
      Returns:
      a copy of $this builder
    • asScope

      Used to declare that the object to be created is an scope.
      Returns:
      a copy of this builder
    • asNamed

      Used to declare that the object to be created has a name attribute
      Returns:
      a copy of this builder
    • withObjectFactoryType

      public ComponentBuildingDefinition.Builder<T> withObjectFactoryType(Class<? extends ObjectFactory<T>> objectFactoryType)
      Defines a factory class to be used for creating the object. This method can be used when the object to be build required complex logic.
      Parameters:
      objectFactoryType - Class for the factory to use to create the object
      Returns:
      a copy of this builder
    • withIgnoredConfigurationParameter

      public ComponentBuildingDefinition.Builder<T> withIgnoredConfigurationParameter(String parameterName)
      Mark configuration parameters to be ignored when building the component. This is mostly useful when AttributeDefinition.Builder.fromUndefinedSimpleAttributes() there are certain configuration parameters that we don't want to included them in the process of building the object.
      Parameters:
      parameterName - the configuration parameter name.
      Returns:
      a copy of this builder.
    • build

      public ComponentBuildingDefinition<T> build()
      Builds a ComponentBuildingDefinition with the parameters set in the builder.

      At least the identifier, namespace and type definition must be configured or this method will fail.

      Returns:
      a fully configured ComponentBuildingDefinition
    • asPrototype

      public ComponentBuildingDefinition.Builder<T> asPrototype()