public class ResolverSet extends Object implements ValueResolver<ResolverSetResult>, org.mule.runtime.api.lifecycle.Initialisable
ValueResolver which is based on associating a set of keys -> ValueResolver pairs. The result of evaluating
this resolver is a ResolverSetResult.
The general purpose of this class is to repeatedly evaluate a set of ValueResolvers 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 keys and
ValueResolvers 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 reusable
| Constructor and Description |
|---|
ResolverSet(MuleContext muleContext) |
| Modifier and Type | Method and Description |
|---|---|
ResolverSet |
add(String key,
ValueResolver resolver)
Links the given
ValueResolver to the given identifying key. |
ResolverSet |
addAll(Map<String,ValueResolver<?>> resolvers)
Links all the given
ValueResolvers to the given identifying key. |
Map<String,ValueResolver<?>> |
getResolvers() |
void |
initialise() |
boolean |
isDynamic()
Whether at least one of the given
ValueResolver are dynamic |
ResolverSet |
merge(ResolverSet resolverSet)
Creates a new instance of
ResolverSet containing all the resolvers
of both this ResolverSet and the given resolverSet |
ResolverSetResult |
resolve(ValueResolvingContext context)
Evaluates all the added
ValueResolvers and returns the results into a ResolverSetResult |
public ResolverSet(MuleContext muleContext)
public ResolverSet add(String key, ValueResolver resolver)
ValueResolver to the given identifying key.key - a non-blank keyresolver - a not null ValueResolverIllegalStateException - if the key was already associated to a resolverIllegalArgumentException - if either key is empty or resolver is nullpublic ResolverSet addAll(Map<String,ValueResolver<?>> resolvers)
ValueResolvers to the given identifying key.resolvers - a not null Map of key-ValueResolverIllegalStateException - if any of the keys were already associated to a resolverIllegalArgumentException - if either key is empty or resolver is null,
on any of the entries.add(String, ValueResolver)public boolean isDynamic()
ValueResolver are dynamicisDynamic in interface ValueResolver<ResolverSetResult>true if at least one resolver is dynamic. false otherwisepublic ResolverSetResult resolve(ValueResolvingContext context) throws org.mule.runtime.api.exception.MuleException
ValueResolvers and returns the results into a ResolverSetResultresolve in interface ValueResolver<ResolverSetResult>context - a not null ValueResolvingContextResolverSetResultorg.mule.runtime.api.exception.MuleException - if an error occurs creating the ResolverSetResultpublic ResolverSet merge(ResolverSet resolverSet)
ResolverSet containing all the resolvers
of both this ResolverSet and the given resolverSetresolverSet - a ResolverSet to merge with this ResolverSetResolverSet containing all the resolvers.IllegalStateException - if a duplicated key is found during the mergeIllegalArgumentException - if the given resolverSet is nullpublic Map<String,ValueResolver<?>> getResolvers()
public void initialise()
initialise in interface org.mule.runtime.api.lifecycle.InitialisableCopyright © 2003–2017 MuleSoft, Inc.. All rights reserved.