public static class ComponentBuildingDefinition.Builder<T> extends Object
ComponentBuildingDefinition
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
ComponentBuildingDefinition.Builder<T> |
alwaysEnabled(boolean value)
This method configures the component as enabled even if excluded from a partial application model (for instance
when building one for data sense).
|
ComponentBuildingDefinition.Builder<T> |
asNamed()
Used to declare that the object to be created has a name attribute
|
ComponentBuildingDefinition.Builder<T> |
asPrototype() |
ComponentBuildingDefinition.Builder<T> |
asScope()
Used to declare that the object to be created is an scope.
|
ComponentBuildingDefinition<T> |
build()
Builds a
ComponentBuildingDefinition with the parameters set in the builder. |
ComponentBuildingDefinition.Builder<T> |
withConstructorParameterDefinition(AttributeDefinition attributeDefinition)
Adds a new constructor parameter to be used during the object instantiation.
|
ComponentBuildingDefinition.Builder<T> |
withIdentifier(String identifier)
Sets the identifier of the configuration element that this building definition is for.
|
ComponentBuildingDefinition.Builder<T> |
withIgnoredConfigurationParameter(String parameterName)
Mark configuration parameters to be ignored when building the component.
|
ComponentBuildingDefinition.Builder<T> |
withKeyTypeConverter(TypeConverter typeConverter)
This method allows to convert a map entry key to another type using a converter.
|
ComponentBuildingDefinition.Builder<T> |
withNamespace(String namespace)
Sets the namespace of the configuration element that this building definition is for.
|
ComponentBuildingDefinition.Builder<T> |
withObjectFactoryType(Class<? extends ObjectFactory<T>> objectFactoryType)
Defines a factory class to be used for creating the object.
|
ComponentBuildingDefinition.Builder<T> |
withRegistrationName(String name)
Set the component name that will appear in the registry.
|
ComponentBuildingDefinition.Builder<T> |
withSetterParameterDefinition(String fieldName,
AttributeDefinition attributeDefinition)
Adds a new parameter to be added to the object by using a setter method.
|
ComponentBuildingDefinition.Builder<T> |
withTypeConverter(TypeConverter typeConverter)
This method allows to convert a simple type to another type using a converter.
|
ComponentBuildingDefinition.Builder<T> |
withTypeDefinition(TypeDefinition<T> typeDefinition)
Sets the
TypeDefinition to discover the object type. |
public ComponentBuildingDefinition.Builder<T> withConstructorParameterDefinition(AttributeDefinition attributeDefinition)
attributeDefinition
- the constructor argument definition.this
builderpublic ComponentBuildingDefinition.Builder<T> withSetterParameterDefinition(String fieldName, AttributeDefinition attributeDefinition)
fieldName
- the name of the field in which the value must be injectedattributeDefinition
- the setter parameter definitionthis
builderpublic ComponentBuildingDefinition.Builder<T> withIdentifier(String identifier)
identifier
- configuration element identifierthis
builderpublic ComponentBuildingDefinition.Builder<T> withNamespace(String namespace)
namespace
- configuration element namespacethis
builderpublic ComponentBuildingDefinition.Builder<T> withTypeDefinition(TypeDefinition<T> typeDefinition)
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.typeDefinition
- the type definition to discover the objecvt typethis
builderpublic ComponentBuildingDefinition.Builder<T> withTypeConverter(TypeConverter typeConverter)
TypeConverter
are only allowed when the produce type by the component is any of java primitive types, its wrapper
or string.typeConverter
- converter from the configuration value to a custom type.this
builderpublic ComponentBuildingDefinition.Builder<T> withKeyTypeConverter(TypeConverter typeConverter)
TypeConverter
are only allowed when the produce type by the component is any of java primitive types, its wrapper
or string.typeConverter
- converter from the configuration value to a custom type.this
builderpublic ComponentBuildingDefinition.Builder<T> alwaysEnabled(boolean value)
value
- boolean indicating if the component should be always enabledthis
builderpublic ComponentBuildingDefinition.Builder<T> withRegistrationName(String name)
name
- the component namethis
builderpublic ComponentBuildingDefinition.Builder<T> asScope()
this
builderpublic ComponentBuildingDefinition.Builder<T> asNamed()
this
builderpublic ComponentBuildingDefinition.Builder<T> withObjectFactoryType(Class<? extends ObjectFactory<T>> objectFactoryType)
objectFactoryType
- Class
for the factory to use to create the objectthis
builderpublic ComponentBuildingDefinition.Builder<T> withIgnoredConfigurationParameter(String parameterName)
AttributeDefinition.Builder.fromUndefinedSimpleAttributes()
there are certain configuration parameters that we
don't want to included them in the process of building the object.parameterName
- the configuration parameter name.this
builder.public ComponentBuildingDefinition<T> build()
ComponentBuildingDefinition
with the parameters set in the builder.
At least the identifier, namespace and type definition must be configured or this method will fail.ComponentBuildingDefinition
public ComponentBuildingDefinition.Builder<T> asPrototype()
Copyright © 2018. All rights reserved.