public final class ConfigurationObjectBuilder extends Object
ObjectBuilder
to create instances that
implement a given Configuration
.
The object instances are created through the Configuration#getInstantiator()#instantiateObject()
method. A ResolverSet
is also used to automatically set this builders
properties. The name of the properties in the must match
the
name of an actual property in the prototype classConstructor and Description |
---|
ConfigurationObjectBuilder(org.mule.extension.introspection.Configuration configuration,
ResolverSet resolverSet) |
Modifier and Type | Method and Description |
---|---|
ObjectBuilder<T> |
addPropertyResolver(Field field,
ValueResolver<? extends Object> resolver)
Adds a property which value is to be obtained from
a
ValueResolver |
ObjectBuilder<T> |
addPropertyValue(Field field,
Object value)
Adds a property which value is given as a constant
|
Object |
build(MuleEvent event)
Returns a new instance of the specified class.
|
Object |
build(ResolverSetResult result) |
protected Object |
instantiateObject()
Creates a new instance by calling
Configuration#getInstantiator()#instantiateObject()
Returns the instance to be returned before the properties have
been applied to it |
boolean |
isDynamic()
Whether any of the registered
ValueResolver s are dynamic |
public ConfigurationObjectBuilder(org.mule.extension.introspection.Configuration configuration, ResolverSet resolverSet)
public Object build(MuleEvent event) throws MuleException
MuleEvent
will be used to obtain a
value from each registered ValueResolver
build
in interface ObjectBuilder<Object>
event
- a MuleEvent
MuleException
public Object build(ResolverSetResult result) throws MuleException
MuleException
protected Object instantiateObject()
Configuration#getInstantiator()#instantiateObject()
Returns the instance to be returned before the properties have
been applied to itpublic ObjectBuilder<T> addPropertyResolver(Field field, ValueResolver<? extends Object> resolver)
ValueResolver
addPropertyResolver
in interface ObjectBuilder<T>
field
- the Field
in which the value is to be assignedresolver
- a ValueResolver
used to provide the actual valuepublic ObjectBuilder<T> addPropertyValue(Field field, Object value)
ObjectBuilder
addPropertyValue
in interface ObjectBuilder<T>
field
- the Field
in which the value is to be assignedvalue
- the value to be setpublic boolean isDynamic()
ValueResolver
s are dynamicisDynamic
in interface ObjectBuilder<T>
true
if at least one resolver is dynamic. false
otherwiseCopyright © 2003–2015 MuleSoft, Inc.. All rights reserved.