Search in sources :

Example 1 with ObjectBuilderValueResolver

use of org.mule.runtime.module.extension.internal.runtime.resolver.ObjectBuilderValueResolver in project mule by mulesoft.

the class TopLevelParameterObjectFactory method doGetObject.

@Override
public Object doGetObject() throws Exception {
    return withContextClassLoader(classLoader, () -> {
        // TODO MULE-10919 - This logic is similar to that of the resolverset object builder and should
        // be generalized
        DefaultObjectBuilder builder = this.builder.get();
        resolveParameters(objectType, builder);
        resolveParameterGroups(objectType, builder);
        injectFields();
        ValueResolver<Object> resolver = new ObjectBuilderValueResolver<>(builder, muleContext);
        if (resolver.isDynamic()) {
            return resolver;
        }
        CoreEvent initialiserEvent = null;
        try {
            initialiserEvent = getInitialiserEvent(muleContext);
            staticProduct = resolver.resolve(from(initialiserEvent));
            muleContext.getInjector().inject(staticProduct);
            return staticProduct;
        } finally {
            if (initialiserEvent != null) {
                ((BaseEventContext) initialiserEvent.getContext()).success();
            }
        }
    }, Exception.class, exception -> {
        throw exception;
    });
}
Also used : BaseEventContext(org.mule.runtime.core.privileged.event.BaseEventContext) CoreEvent(org.mule.runtime.core.api.event.CoreEvent) ObjectBuilderValueResolver(org.mule.runtime.module.extension.internal.runtime.resolver.ObjectBuilderValueResolver) DefaultObjectBuilder(org.mule.runtime.module.extension.internal.runtime.objectbuilder.DefaultObjectBuilder)

Aggregations

CoreEvent (org.mule.runtime.core.api.event.CoreEvent)1 BaseEventContext (org.mule.runtime.core.privileged.event.BaseEventContext)1 DefaultObjectBuilder (org.mule.runtime.module.extension.internal.runtime.objectbuilder.DefaultObjectBuilder)1 ObjectBuilderValueResolver (org.mule.runtime.module.extension.internal.runtime.resolver.ObjectBuilderValueResolver)1