public class DefaultObjectBuilder<T> extends Object
ObjectBuilder
which
creates instances through a provided Class
.
That class needs to have a public default constructorConstructor and Description |
---|
DefaultObjectBuilder(Class<T> prototypeClass) |
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
|
T |
build(MuleEvent event)
Returns a new instance of the specified class.
|
protected T |
instantiateObject()
Creates a new instance by calling the default constructor on
prototypeClass
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 |
protected T instantiateObject()
prototypeClass
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
otherwisepublic T build(MuleEvent event) throws MuleException
MuleEvent
will be used to obtain a
value from each registered ValueResolver
build
in interface ObjectBuilder<T>
event
- a MuleEvent
MuleException
Copyright © 2003–2015 MuleSoft, Inc.. All rights reserved.