use of org.mule.runtime.module.extension.internal.runtime.objectbuilder.DefaultObjectBuilder in project mule by mulesoft.
the class DefaultObjectBuilderTestCase method buildInterface.
@Test(expected = IllegalArgumentException.class)
public void buildInterface() throws Exception {
builder = new DefaultObjectBuilder(InternalMessage.class);
builder.build(resolvingContext);
}
use of org.mule.runtime.module.extension.internal.runtime.objectbuilder.DefaultObjectBuilder in project mule by mulesoft.
the class TopLevelParameterObjectFactory method injectFields.
private void injectFields() {
DefaultObjectBuilder builder = this.builder.get();
builder.setEncoding(muleContext.getConfiguration().getDefaultEncoding());
if (name != null) {
builder.setName(name);
}
}
use of org.mule.runtime.module.extension.internal.runtime.objectbuilder.DefaultObjectBuilder in project mule by mulesoft.
the class ComponentMessageProcessor method createFieldParameterGroupBuilder.
private ObjectBuilder createFieldParameterGroupBuilder(ParameterGroupDescriptor groupDescriptor, List<ParameterModel> fieldParameters) {
DefaultObjectBuilder groupBuilder = new DefaultObjectBuilder(groupDescriptor.getType().getDeclaringClass().get());
fieldParameters.forEach(p -> {
ValueResolver resolver = resolverSet.getResolvers().get(p.getName());
if (resolver != null) {
groupBuilder.addPropertyResolver(getMemberName(p), resolver);
}
});
return groupBuilder;
}
use of org.mule.runtime.module.extension.internal.runtime.objectbuilder.DefaultObjectBuilder in project mule by mulesoft.
the class ParametersResolver method resolveParameterGroups.
/**
* {@inheritDoc}
*/
@Override
public void resolveParameterGroups(ObjectType objectType, DefaultObjectBuilder builder) {
Class<?> objectClass = getType(objectType);
objectType.getFields().stream().filter(ExtensionMetadataTypeUtils::isFlattenedParameterGroup).forEach(groupField -> {
if (!(groupField.getValue() instanceof ObjectType)) {
return;
}
final ObjectType groupType = (ObjectType) groupField.getValue();
final Field objectField = getField(objectClass, getLocalPart(groupField));
DefaultObjectBuilder groupBuilder = getParameterGroupObjectBuilder(groupField);
builder.addPropertyResolver(objectField.getName(), new ObjectBuilderValueResolver<>(groupBuilder, muleContext));
resolveParameters(groupType, groupBuilder);
resolveParameterGroups(groupType, groupBuilder);
});
}
use of org.mule.runtime.module.extension.internal.runtime.objectbuilder.DefaultObjectBuilder in project mule by mulesoft.
the class MetadataKeyIdObjectResolver method instantiateFromFieldValue.
private Object instantiateFromFieldValue(Class<?> metadataKeyType, Map<Field, String> fieldValueMap) throws MetadataResolvingException {
try {
DefaultObjectBuilder objectBuilder = new DefaultObjectBuilder<>(metadataKeyType);
fieldValueMap.forEach((f, v) -> objectBuilder.addPropertyResolver(f.getName(), new StaticValueResolver<>(v)));
return objectBuilder.build(null);
} catch (Exception e) {
throw buildException(format("MetadataKey object of type '%s' from the component '%s' could not be instantiated", metadataKeyType.getSimpleName(), component.getName()), e);
}
}
Aggregations