final String formattedPrefix, final String topLevelPackage,
final String basePackage) {
final Collection<JavaType> typesInModule = getTypesForModule(
optionContext, targetModule);
if (typesInModule.isEmpty()) {
completions.add(new Completion(prefix + targetModule.getGroupId(),
formattedPrefix + targetModule.getGroupId(), heading, 1));
}
else {
completions.add(new Completion(prefix + topLevelPackage,
formattedPrefix + topLevelPackage, heading, 1));
for (final JavaType javaType : typesInModule) {
String type = javaType.getFullyQualifiedTypeName();
if (type.startsWith(basePackage)) {
type = StringUtils.replace(type, topLevelPackage,
TOP_LEVEL_PACKAGE_SYMBOL, 1);
completions.add(new Completion(prefix + type,
formattedPrefix + type, heading, 1));
}
}
}
}