public String getFullPathName() { return delegate.getFullPathName(); }
public GroovyClassDoc classNamed(GroovyClassDoc groovyClassDoc, String name) { // look for full match or match excluding package for (String key : classDocs.keySet()) { if (key.equals(name)) return classDocs.get(key); int lastSlashIdx = key.lastIndexOf('/'); if (lastSlashIdx > 0) { String shortKey = key.substring(lastSlashIdx + 1); String fullPathName = groovyClassDoc != null ? groovyClassDoc.getFullPathName() : null; boolean hasPackage = (fullPathName != null && fullPathName.lastIndexOf('/') > 0); if (hasPackage) fullPathName = fullPathName.substring(0, fullPathName.lastIndexOf('/')); if (shortKey.equals(name) && (!hasPackage || key.startsWith(fullPathName))) { return classDocs.get(key); } } } return null; }
public void writeClassToOutput(GroovyClassDoc classDoc, String destdir) throws Exception { if (classDoc.isPublic() || classDoc.isProtected() && "true".equals(properties.getProperty("protectedScope")) || classDoc.isPackagePrivate() && "true".equals(properties.getProperty("packageScope")) || "true".equals(properties.getProperty("privateScope"))) { String destFileName = destdir + FS + classDoc.getFullPathName() + ".html"; log.debug("Generating " + destFileName); String renderedSrc = templateEngine.applyClassTemplates(classDoc); output.writeToOutput(destFileName, renderedSrc, properties.getProperty("fileEncoding")); } }
private GroovyClassDoc getGroovyClassDocByName(GroovyRootDoc root, String name) { GroovyClassDoc[] classes = root.classes(); for (GroovyClassDoc clazz : classes) { if (clazz.getFullPathName().endsWith(name)) { return clazz; } } return null; } }
GroovyClassDoc doc = rootDoc.classNamed(classDoc, slashedName); if (doc != null) { target[0] = doc.getFullPathName(); // if we added a package return buildUrl(relativePath, target, label == null ? name : label);
String innerClassName = name.substring(slashIndex + 1); SimpleGroovyClassDoc innerClass = new SimpleGroovyClassDoc(importedClassesAndPackages, aliases, innerClassName); innerClass.setFullPathName(gcd.getFullPathName() + "." + innerClassName); return innerClass;
if (iterator.hasNext()) { final Map.Entry<String, GroovyClassDoc> docEntry = iterator.next(); String fullPath = docEntry.getValue().getFullPathName(); int slash = fullPath.lastIndexOf(FS); if (slash > 0) packagePath = fullPath.substring(0, slash);
public void testWrongPackageNameInClassHierarchyWithPlainTool() throws Exception { List<String> srcList = new ArrayList<String>(); String fullPathBaseA = "org/codehaus/groovy/tools/groovydoc/testfiles/a/Base"; srcList.add(fullPathBaseA + ".groovy"); String fullPathBaseB = "org/codehaus/groovy/tools/groovydoc/testfiles/b/Base"; srcList.add(fullPathBaseB + ".groovy"); String fullPathBaseC = "org/codehaus/groovy/tools/groovydoc/testfiles/c/Base"; srcList.add("org/codehaus/groovy/tools/groovydoc/testfiles/a/DescendantA.groovy"); srcList.add("org/codehaus/groovy/tools/groovydoc/testfiles/b/DescendantB.groovy"); srcList.add("org/codehaus/groovy/tools/groovydoc/testfiles/a/DescendantC.groovy"); srcList.add("org/codehaus/groovy/tools/groovydoc/testfiles/a/DescendantD.groovy"); srcList.add("org/codehaus/groovy/tools/groovydoc/testfiles/c/DescendantE.groovy"); srcList.add("org/codehaus/groovy/tools/groovydoc/testfiles/c/DescendantF.groovy"); plainTool.add(srcList); GroovyRootDoc root = plainTool.getRootDoc(); // loop through classes in tree GroovyClassDoc classDocDescendantA = getGroovyClassDocByName(root, "DescendantA"); assertTrue(fullPathBaseA.equals(root.classNamed(classDocDescendantA, "Base").getFullPathName())); GroovyClassDoc classDocDescendantB = getGroovyClassDocByName(root, "DescendantB"); assertTrue(fullPathBaseB.equals(root.classNamed(classDocDescendantB, "Base").getFullPathName())); GroovyClassDoc classDocDescendantC = getGroovyClassDocByName(root, "DescendantC"); assertTrue(fullPathBaseA.equals(root.classNamed(classDocDescendantC, "Base").getFullPathName())); GroovyClassDoc classDocDescendantD = getGroovyClassDocByName(root, "DescendantD"); assertTrue(fullPathBaseA.equals(root.classNamed(classDocDescendantD, "Base").getFullPathName())); GroovyClassDoc classDocDescendantE = getGroovyClassDocByName(root, "DescendantE"); assertTrue(fullPathBaseC.equals(root.classNamed(classDocDescendantE, "Base").getFullPathName())); GroovyClassDoc classDocDescendantF = getGroovyClassDocByName(root, "DescendantF"); assertTrue(fullPathBaseC.equals(root.classNamed(classDocDescendantF, "Base").getFullPathName())); }
public String getFullPathName() { return delegate.getFullPathName(); }
public String getFullPathName() { return delegate.getFullPathName(); }
public GroovyClassDoc classNamed(GroovyClassDoc groovyClassDoc, String name) { // look for full match or match excluding package for (String key : classDocs.keySet()) { if (key.equals(name)) return classDocs.get(key); int lastSlashIdx = key.lastIndexOf('/'); if (lastSlashIdx > 0) { String shortKey = key.substring(lastSlashIdx + 1); String fullPathName = groovyClassDoc.getFullPathName(); boolean hasPackage = fullPathName.lastIndexOf('/') > 0; if (hasPackage) fullPathName = fullPathName.substring(0, fullPathName.lastIndexOf('/')); if (shortKey.equals(name) && (!hasPackage || key.startsWith(fullPathName))) { return classDocs.get(key); } } } return null; }
private GroovyClassDoc performLookup(GroovyClassDoc groovyClassDoc, String name) { // look for full match or match excluding package String fullPathName = groovyClassDoc != null ? groovyClassDoc.getFullPathName() : null; boolean hasPackage = (fullPathName != null && fullPathName.lastIndexOf('/') > 0); if (hasPackage) { fullPathName = fullPathName.substring(0, fullPathName.lastIndexOf('/')); } for (Map.Entry<String, GroovyClassDoc> entry : classDocs.entrySet()) { String key = entry.getKey(); int lastSlashIdx = key.lastIndexOf('/'); if (lastSlashIdx > 0) { String shortKey = key.substring(lastSlashIdx + 1); if (shortKey.equals(name) && (!hasPackage || key.startsWith(fullPathName))) { GroovyClassDoc value = entry.getValue(); return value; } } } return null; }
public void writeClassToOutput(GroovyClassDoc classDoc, String destdir) throws Exception { String destFileName = destdir + FS + classDoc.getFullPathName() + ".html"; System.out.println("Generating " + destFileName); String renderedSrc = templateEngine.applyClassTemplates(classDoc);// todo output.writeToOutput(destFileName, renderedSrc); }
public void writeClassToOutput(GroovyClassDoc classDoc, String destdir) throws Exception { String destFileName = destdir + FS + classDoc.getFullPathName() + ".html"; System.out.println("Generating " + destFileName); String renderedSrc = templateEngine.applyClassTemplates(classDoc); output.writeToOutput(destFileName, renderedSrc); }
public void writeClassToOutput(GroovyClassDoc classDoc, String destdir) throws Exception { String destFileName = destdir + FS + classDoc.getFullPathName() + ".html"; System.out.println("Generating " + destFileName); String renderedSrc = templateEngine.applyClassTemplates(classDoc); output.writeToOutput(destFileName, renderedSrc); }
public void writeClassToOutput(GroovyClassDoc classDoc, String destdir) throws Exception { if (classDoc.isPublic() || classDoc.isProtected() && "true".equals(properties.getProperty("protectedScope")) || classDoc.isPackagePrivate() && "true".equals(properties.getProperty("packageScope")) || "true".equals(properties.getProperty("privateScope"))) { String destFileName = destdir + FS + classDoc.getFullPathName() + ".html"; log.debug("Generating " + destFileName); String renderedSrc = templateEngine.applyClassTemplates(classDoc); output.writeToOutput(destFileName, renderedSrc, properties.getProperty("fileEncoding")); } }
public void writeClassToOutput(GroovyClassDoc classDoc, String destdir) throws Exception { if (classDoc.isPublic() || classDoc.isProtected() && "true".equals(properties.getProperty("protectedScope")) || classDoc.isPackagePrivate() && "true".equals(properties.getProperty("packageScope")) || "true".equals(properties.getProperty("privateScope"))) { String destFileName = destdir + FS + classDoc.getFullPathName() + ".html"; log.debug("Generating " + destFileName); String renderedSrc = templateEngine.applyClassTemplates(classDoc); output.writeToOutput(destFileName, renderedSrc); } }
String applyClassTemplates(GroovyClassDoc classDoc) { String templatePath = classTemplatePaths.get(0); // todo (iterate) String templateWithBindingApplied = ""; try { Template t = classTemplates.get(templatePath); if (t == null) { t = engine.createTemplate(resourceManager.getReader(templatePath)); classTemplates.put(templatePath, t); } Map<String, Object> binding = new LinkedHashMap<String, Object>(); binding.put("classDoc", classDoc); binding.put("props", properties); templateWithBindingApplied = t.make(binding).writeTo(reasonableSizeWriter()).toString(); } catch (Exception e) { System.out.println("Error processing class template for: " + classDoc.getFullPathName()); e.printStackTrace(); } return templateWithBindingApplied; }
if (iterator.hasNext()) { final Map.Entry<String, GroovyClassDoc> docEntry = iterator.next(); String fullPath = docEntry.getValue().getFullPathName(); int slash = fullPath.lastIndexOf(FS); if (slash > 0) packagePath = fullPath.substring(0, slash);
if (iterator.hasNext()) { final Map.Entry<String, GroovyClassDoc> docEntry = iterator.next(); String fullPath = docEntry.getValue().getFullPathName(); int slash = fullPath.lastIndexOf(FS); if (slash > 0) packagePath = fullPath.substring(0, slash);