use of org.mule.runtime.module.extension.internal.loader.java.property.BackPressureStrategyModelProperty in project mule by mulesoft.
the class BackPressureDeclarationEnricher method enrich.
@Override
public void enrich(ExtensionLoadingContext extensionLoadingContext) {
final ExtensionDeclaration extensionDeclaration = extensionLoadingContext.getExtensionDeclarer().getDeclaration();
new IdempotentDeclarationWalker() {
@Override
protected void onSource(SourceDeclaration sourceDeclaration) {
BackPressureStrategyModelProperty property;
Optional<ExtensionTypeDescriptorModelProperty> extensionTypeDescriptorModelProperty = sourceDeclaration.getModelProperty(ExtensionTypeDescriptorModelProperty.class);
if (extensionTypeDescriptorModelProperty.isPresent()) {
Type sourceType = extensionTypeDescriptorModelProperty.get().getType();
property = sourceType.getAnnotation(BackPressure.class).map(BackPressureStrategyModelProperty::of).orElseGet(BackPressureStrategyModelProperty::getDefault);
sourceDeclaration.addModelProperty(property);
if (property.getSupportedModes().size() > 1) {
addBackPressureParameter(extensionDeclaration, sourceDeclaration, property);
}
}
}
}.walk(extensionDeclaration);
}
Aggregations