use of org.mule.metadata.api.model.UnionType in project mule by mulesoft.
the class DefaultExtensionBuildingDefinitionProvider method registerTopLevelParameter.
private void registerTopLevelParameter(final MetadataType parameterType, Builder definitionBuilder, ClassLoader extensionClassLoader, DslSyntaxResolver dslSyntaxResolver, ExtensionParsingContext parsingContext, ReflectionCache reflectionCache) {
Optional<DslElementSyntax> dslElement = dslSyntaxResolver.resolve(parameterType);
if (!dslElement.isPresent() || parsingContext.isRegistered(dslElement.get().getElementName(), dslElement.get().getPrefix()) || !IntrospectionUtils.isInstantiable(parameterType, reflectionCache)) {
return;
}
parameterType.accept(new MetadataTypeVisitor() {
@Override
public void visitObject(ObjectType objectType) {
DslElementSyntax pojoDsl = dslElement.get();
if (pojoDsl.supportsTopLevelDeclaration() || (pojoDsl.supportsChildDeclaration() && pojoDsl.isWrapped()) || getSubstitutionGroup(objectType).isPresent() || parsingContext.getAllSubTypes().contains(objectType)) {
parseWith(new ObjectTypeParameterParser(definitionBuilder, objectType, extensionClassLoader, dslSyntaxResolver, parsingContext));
}
registerSubTypes(objectType, definitionBuilder, extensionClassLoader, dslSyntaxResolver, parsingContext, reflectionCache);
}
@Override
public void visitArrayType(ArrayType arrayType) {
registerTopLevelParameter(arrayType.getType(), definitionBuilder, extensionClassLoader, dslSyntaxResolver, parsingContext, reflectionCache);
}
@Override
public void visitUnion(UnionType unionType) {
unionType.getTypes().forEach(type -> type.accept(this));
}
});
}
Aggregations