use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration in project mule by mulesoft.
the class SubTypesDeclarationEnricher method enrich.
@Override
public void enrich(ExtensionLoadingContext extensionLoadingContext) {
ExtensionDeclarer declarer = extensionLoadingContext.getExtensionDeclarer();
ExtensionDeclaration extensionDeclaration = declarer.getDeclaration();
Optional<ExtensionTypeDescriptorModelProperty> implementingType = extensionDeclaration.getModelProperty(ExtensionTypeDescriptorModelProperty.class);
if (!implementingType.isPresent()) {
return;
}
Type type = implementingType.get().getType();
List<AnnotationValueFetcher<SubTypeMapping>> typeMappings = parseRepeatableAnnotation(type, SubTypeMapping.class, c -> ((SubTypesMapping) c).value());
if (!typeMappings.isEmpty()) {
declareSubTypesMapping(declarer, typeMappings, extensionDeclaration.getName());
}
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration 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);
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration in project mule by mulesoft.
the class BooleanParameterDeclarationEnricher method enrich.
@Override
public void enrich(ExtensionLoadingContext extensionLoadingContext) {
ExtensionDeclaration extensionDeclaration = extensionLoadingContext.getExtensionDeclarer().getDeclaration();
new DeclarationWalker() {
@Override
protected void onParameter(ParameterizedDeclaration owner, ParameterGroupDeclaration parameterGroup, ParameterDeclaration declaration) {
declaration.getType().accept(new MetadataTypeVisitor() {
@Override
public void visitBoolean(BooleanType booleanType) {
declaration.setRequired(false);
if (declaration.getDefaultValue() == null && !declaration.isConfigOverride()) {
declaration.setDefaultValue(valueOf(FALSE));
}
}
});
}
}.walk(extensionDeclaration);
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method minMuleVersionDefaultValueIsDescribedCorrectly.
@Test
public void minMuleVersionDefaultValueIsDescribedCorrectly() {
setLoader(loaderFor(PetStoreConnector.class));
ExtensionDeclarer declarer = declareExtension();
final ExtensionDeclaration declaration = declarer.getDeclaration();
}
use of org.mule.runtime.api.meta.model.declaration.fluent.ExtensionDeclaration in project mule by mulesoft.
the class JavaDeclarationDelegateTestCase method categoryIsDescribedCorrectly.
@Test
public void categoryIsDescribedCorrectly() {
setLoader(loaderFor(HeisenbergExtension.class));
ExtensionDeclarer declarer = declareExtension();
final ExtensionDeclaration declaration = declarer.getDeclaration();
assertThat(declaration.getCategory(), is(SELECT));
}
Aggregations