builder.setType(determineType(builder, builders.size() - 1, parsingContext));
// definition is guaranteed to be non-null here
ModuleDefinition moduleDefinition = moduleRegistry.findDefinition(builder.getModuleName(), builder.getType());
builder.setModuleDefinition(moduleDefinition);
ModuleOptionsMetadata optionsMetadata = moduleOptionsMetadataResolver.resolve(moduleDefinition);
if (parsingContext.shouldBindAndValidate()) {
try {
optionsMetadata.interpolate(builder.getParameters());
}
catch (BindException e) {
throw ModuleConfigurationException.fromBindException(builder.getModuleName(),
builder.getType(), e);
}