@Override public String apply(String input) { boolean assumedUnqualified = Ascii.isUpperCase(input.charAt(0)); if (assumedUnqualified) { input = qualifyImportedIfPossible(input); } return input; }
@VisibleForTesting static String fromSecondLevel(String qualifiedTemplateClass) { List<String> path = Splitter.on('.').splitToList(qualifiedTemplateClass); for (int topLevel = 0; topLevel < path.size() - 1; topLevel++) { if (Ascii.isUpperCase(path.get(topLevel).charAt(0))) { return Joiner.on('_').join(path.subList(topLevel + 1, path.size())); } } return Iterables.getLast(path); }
private Entry<String, List<String>> resolveTypes(Entry<String, List<String>> sourceTypes) { String typeName = sourceTypes.getKey(); boolean assumedNotQualified = Ascii.isUpperCase(typeName.charAt(0)); if (assumedNotQualified) { typeName = resolveIfPossible(typeName); } List<String> typeArguments = Lists.newArrayListWithCapacity(sourceTypes.getValue().size()); for (String typeArgument : sourceTypes.getValue()) { String resolvedTypeArgument = SourceTypes.stringify(resolveTypes(SourceTypes.extract(typeArgument))); typeArguments.add(resolvedTypeArgument); } return Maps.immutableEntry(typeName, typeArguments); }
private void appendResolved(DeclaredType type) { TypeElement typeElement = (TypeElement) type.asElement(); String typeName = typeElement.getQualifiedName().toString(); if (unresolvedTypeHasOccured) { boolean assumedNotQualified = Ascii.isUpperCase(typeName.charAt(0)); if (assumedNotQualified) { typeName = resolveIfPossible(typeName); } } buffer.append(typeName); if (startType == type) { rawTypeName = typeName; } }