public class DefaultObjectBuilder<T> extends Object implements ObjectBuilder<T>
ObjectBuilder which creates instances through a provided Class.| Modifier and Type | Field and Description |
|---|---|
protected Class<T> |
prototypeClass |
protected Map<Field,ValueResolver<Object>> |
resolvers |
| Constructor and Description |
|---|
DefaultObjectBuilder(Class<T> prototypeClass)
Creates a new instance that will build instances of
prototypeClass. |
| Modifier and Type | Method and Description |
|---|---|
ObjectBuilder<T> |
addPropertyResolver(String propertyName,
ValueResolver<? extends Object> resolver)
Adds a property which value is to be obtained from a
ValueResolver |
T |
build(ValueResolvingContext context)
Returns a new instance of the specified class.
|
boolean |
isDynamic()
Whether any of the registered
ValueResolvers are dynamic |
void |
setEncoding(String encoding) |
void |
setName(String name) |
protected final Map<Field,ValueResolver<Object>> resolvers
public ObjectBuilder<T> addPropertyResolver(String propertyName, ValueResolver<? extends Object> resolver)
ValueResolverpropertyName - the name of the property in which the value is to be assignedresolver - a ValueResolver used to provide the actual value{@link - java.lang.IllegalArgumentException} if method or resolver are nullpublic boolean isDynamic()
ValueResolvers are dynamicisDynamic in interface ObjectBuilder<T>true if at least one resolver is dynamic. false otherwisepublic T build(ValueResolvingContext context) throws org.mule.runtime.api.exception.MuleException
ObjectBuilderValueResolvingContext will be used to obtain a value
from each registered ValueResolverbuild in interface ObjectBuilder<T>context - a ValueResolvingContextorg.mule.runtime.api.exception.MuleExceptionpublic void setName(String name)
public void setEncoding(String encoding)
Copyright © 2003–2017 MuleSoft, Inc.. All rights reserved.