/** * Package private helper to get the location backed up by this proto file for the given element. */ Location getLocation(ProtoElement element) { if (protoToLocation.containsKey(element)) { return protoToLocation.get(element); } Location location = ProtoLocation.convertFrom(getSourceCodeLocation(element.getPath()), element); protoToLocation.put(element, location); return location; }
/** * Package private helper to get the location backed up by this proto file for the given element. */ Location getLocation(ProtoElement element) { if (protoToLocation.containsKey(element)) { return protoToLocation.get(element); } Location location = ProtoLocation.convertFrom(getSourceCodeLocation(element.getPath()), element); protoToLocation.put(element, location); return location; }
/** * Helper to get the documentation backed up by this proto file for the given * element. */ public String getDocumentation(ProtoElement element) { if (element instanceof ProtoFile) { // For files themselves, comments from multiple locations are composed. StringBuilder result = new StringBuilder(); for (String path : FILE_DOC_LOCATIONS) { String comment = getDocumentation(path); if (Strings.isNullOrEmpty(comment)) { continue; } if (result.length() > 0) { result.append('\n'); } result.append(comment); } return result.toString(); } else { return getDocumentation(element.getPath()); } }
/** * Helper to get the documentation backed up by this proto file for the given * element. */ public String getDocumentation(ProtoElement element) { if (element instanceof ProtoFile) { // For files themselves, comments from multiple locations are composed. StringBuilder result = new StringBuilder(); for (String path : FILE_DOC_LOCATIONS) { String comment = getDocumentation(path); if (Strings.isNullOrEmpty(comment)) { continue; } if (result.length() > 0) { result.append('\n'); } result.append(comment); } return result.toString(); } else { return getDocumentation(element.getPath()); } }