private void visitLink(PackageElement pkgElt, String label, String signature, DocGenerator generator, DocWriter writer) { ElementResolution res = resolutions.get(signature); if (res == null) { res = new ElementResolution(signature); resolutions.put(signature, res); } LinkProcessing fut = new LinkProcessing(generator, label); res.add(fut); writer.write(() -> { DocWriter ww = fut.writer; if (ww == null) { throw new DocGenException(pkgElt, "Could not resolve " + signature); } return ww; }); }
@Override public Void visitEndElement(EndElementTree node, Void v) { writer.write("</"); writer.append(node.getName()); writer.append('>'); return v; }
@Test public void testFuture() throws IOException { DocWriter writer = new DocWriter(); writer.write("a"); writer.write(() -> { DocWriter n1 = new DocWriter(); n1.write("b"); n1.write(() -> { DocWriter n2 = new DocWriter(); n2.write("c"); return n2; }); return n1; }); writer.write("d"); assertEquals("abcd", writer.render()); assertEquals("", writer.render()); }
int prev = 0; while (matcher.find()) { writer.write(content, prev, matcher.start() - prev); String value = matcher.group(1).trim(); StringTokenizer tokenizer = new StringTokenizer(value);
private void assertCommentText(String actual, String expected) throws IOException { DocWriter writer = new DocWriter(); writer.write(actual); assertEquals(expected, writer.render()); }
private void assertLiteralText(String actual, String expected) throws IOException { DocWriter writer = new DocWriter(); writer.literalMode(); writer.write(actual); assertEquals(expected, writer.render()); } }