Module org.mule.runtime.dsl.api
Class ComponentBuildingDefinition.Builder<T>
java.lang.Object
org.mule.runtime.dsl.api.component.ComponentBuildingDefinition.Builder<T>
- Enclosing class:
- ComponentBuildingDefinition<T>
Builder for
ComponentBuildingDefinition
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionalwaysEnabled(boolean value) Deprecated.since 4.4.asNamed()Used to declare that the object to be created has a name attributeasScope()Used to declare that the object to be created is an scope.build()Builds aComponentBuildingDefinitionwith the parameters set in the builder.withConstructorParameterDefinition(AttributeDefinition attributeDefinition) Adds a new constructor parameter to be used during the object instantiation.withIdentifier(String identifier) Sets the identifier of the configuration element that this building definition is for.withIgnoredConfigurationParameter(String parameterName) Mark configuration parameters to be ignored when building the component.withKeyTypeConverter(TypeConverter typeConverter) This method allows to convert a map entry key to another type using a converter.withNamespace(String namespace) Sets the namespace of the configuration element that this building definition is for.withObjectFactoryType(Class<? extends ObjectFactory<T>> objectFactoryType) Defines a factory class to be used for creating the object.withRegistrationName(String name) Set the component name that will appear in the registry.withSetterParameterDefinition(String fieldName, AttributeDefinition attributeDefinition) Adds a new parameter to be added to the object by using a setter method.withTypeConverter(TypeConverter typeConverter) This method allows to convert a simple type to another type using a converter.withTypeDefinition(TypeDefinition<T> typeDefinition) Sets theTypeDefinitionto discover the object type.
-
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
thisbuilder
-
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 injectedattributeDefinition- the setter parameter definition- Returns:
- a copy of
thisbuilder
-
withIdentifier
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
thisbuilder
-
withNamespace
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
thisbuilder
-
withTypeDefinition
Sets theTypeDefinitionto discover the object type. It may be created fromTypeDefinition.fromType(Class)which means the type is predefined. Or it may be created fromTypeDefinition.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
thisbuilder
-
withTypeConverter
This method allows to convert a simple type to another type using a converter.TypeConverterare 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
thisbuilder
-
withKeyTypeConverter
This method allows to convert a map entry key to another type using a converter.TypeConverterare 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
thisbuilder
-
alwaysEnabled
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 $
thisbuilder
-
withRegistrationName
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 $
thisbuilder
-
asScope
Used to declare that the object to be created is an scope.- Returns:
- a copy of
thisbuilder
-
asNamed
Used to declare that the object to be created has a name attribute- Returns:
- a copy of
thisbuilder
-
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-Classfor the factory to use to create the object- Returns:
- a copy of
thisbuilder
-
withIgnoredConfigurationParameter
public ComponentBuildingDefinition.Builder<T> withIgnoredConfigurationParameter(String parameterName) Mark configuration parameters to be ignored when building the component. This is mostly useful whenAttributeDefinition.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
thisbuilder.
-
build
Builds aComponentBuildingDefinitionwith 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
-