public class ResolverSet extends Object implements ValueResolver<Object>
ValueResolver
which is based on associating a set of
Parameter
s -> ValueResolver
pairs. The result
of evaluating this resolver is a ResolverSetResult
.
The general purpose of this class is to repeatedly evaluate a set of ValueResolver
s
which results are to be used in the construction of an object, so that the structure
of such can be described only once (by the set of Parameter
s and ValueResolver
s
but evaluated many times. With this goal in mind is that the return value of this resolver
will always be a ResolverSetResult
which then can be used by a ObjectBuilder
to generate an actual object.
Instances of this class are to be considered thread safe and reusableConstructor and Description |
---|
ResolverSet() |
Modifier and Type | Method and Description |
---|---|
ResolverSet |
add(org.mule.extension.introspection.Parameter parameter,
ValueResolver resolver)
Links the given
ValueResolver to the given Parameter . |
Map<org.mule.extension.introspection.Parameter,ValueResolver> |
getResolvers() |
boolean |
isDynamic()
Whether at least one of the given
ValueResolver are dynamic |
ResolverSetResult |
resolve(MuleEvent event)
Evaluates all the added
ValueResolver s and returns the results into
a ResolverSetResult |
public ResolverSet add(org.mule.extension.introspection.Parameter parameter, ValueResolver resolver)
ValueResolver
to the given Parameter
.
If such parameter
was already added, then the associated resolver
is replaced.
Since this class implements Lifecycle
and MuleContextAware
,
this method works in tandem with the ones defined in that interface.
All the lifecycle invocations received by this instances are propagates to the
registered resolvers. You should make a best effort then to add all the resolvers
before lifecycle is applied. Otherwise, adding more resolvers will be allowed
but you'll be in charge of whatever lifecycle phases it has missedparameter
- a not null
Parameter
resolver
- a not null
ValueResolver
IllegalArgumentException
- is either parameter
or resolver
are null
public boolean isDynamic()
ValueResolver
are dynamicisDynamic
in interface ValueResolver<Object>
true
if at least one resolver is dynamic. false
otherwisepublic ResolverSetResult resolve(MuleEvent event) throws MuleException
ValueResolver
s and returns the results into
a ResolverSetResult
resolve
in interface ValueResolver<Object>
event
- a not null
MuleEvent
ResolverSetResult
Exception
MuleException
public Map<org.mule.extension.introspection.Parameter,ValueResolver> getResolvers()
Copyright © 2003–2015 MuleSoft, Inc.. All rights reserved.