use of org.mule.runtime.extension.api.annotation.metadata.OutputResolver in project mule by mulesoft.
the class CustomStaticTypeDeclarationEnricher method getAttributesType.
private Optional<MetadataType> getAttributesType(AnnotatedElement element) {
AttributesXmlType xml = element.getAnnotation(AttributesXmlType.class);
if (xml != null) {
return getXmlType(xml.schema(), xml.qname());
}
AttributesJsonType json = element.getAnnotation(AttributesJsonType.class);
if (json != null) {
return getJsonType(json.schema());
}
OutputResolver resolver = element.getAnnotation(OutputResolver.class);
if (resolver != null && isStaticResolver(resolver.attributes())) {
return getCustomStaticType(resolver.attributes());
}
MetadataScope scope = element.getAnnotation(MetadataScope.class);
if (scope != null && isStaticResolver(scope.attributesResolver())) {
return getCustomStaticType(scope.attributesResolver());
}
return empty();
}
use of org.mule.runtime.extension.api.annotation.metadata.OutputResolver in project mule by mulesoft.
the class CustomStaticTypeDeclarationEnricher method getOutputType.
private Optional<MetadataType> getOutputType(AnnotatedElement element) {
OutputXmlType xml = element.getAnnotation(OutputXmlType.class);
if (xml != null) {
return getXmlType(xml.schema(), xml.qname());
}
OutputJsonType json = element.getAnnotation(OutputJsonType.class);
if (json != null) {
return getJsonType(json.schema());
}
OutputResolver resolver = element.getAnnotation(OutputResolver.class);
if (resolver != null && isStaticResolver(resolver.output())) {
return getCustomStaticType(resolver.output());
}
MetadataScope scope = element.getAnnotation(MetadataScope.class);
if (scope != null && isStaticResolver(scope.outputResolver())) {
return getCustomStaticType(scope.outputResolver());
}
return empty();
}
use of org.mule.runtime.extension.api.annotation.metadata.OutputResolver in project mule by mulesoft.
the class FlowListenerBananaOperations method getLunch.
@OutputResolver(output = FruitMetadataResolver.class)
public Fruit getLunch(@Config BananaConfig config, FlowListener listener) {
final Banana banana = new Banana();
listener.onSuccess(message -> {
if (message.getPayload().getValue() instanceof Banana) {
config.onBanana();
} else {
config.onNotBanana();
}
});
listener.onError(exception -> config.onException());
listener.onComplete(() -> banana.peel());
return banana;
}
Aggregations