use of org.mule.metadata.message.api.MessageMetadataTypeBuilder in project mule by mulesoft.
the class MetadataOutputDelegate method wrapInMessageType.
private MetadataType wrapInMessageType(MetadataType type, Object key, MetadataContext context, Optional<MetadataType> staticAttributes) throws MetadataResolvingException {
MessageMetadataTypeBuilder message = new MessageMetadataTypeBuilder().payload(type);
staticAttributes.ifPresent(message::attributes);
if (((HasOutputModel) component).getOutputAttributes().hasDynamicType()) {
MetadataResult<MetadataType> attributes = resolveOutputAttributesMetadata(context, key, Objects::nonNull);
if (!attributes.isSuccess()) {
throw new MetadataResolvingException("Could not resolve attributes of List<Message> output", attributes.getFailures().stream().map(MetadataFailure::getFailureCode).findFirst().orElse(UNKNOWN));
}
message.attributes(attributes.get());
}
return message.build();
}
Aggregations