public CodeTreeBuilder tree(CodeTree treeToAdd) { if (treeToAdd != null) { if (treeToAdd instanceof BuilderCodeTree) { return push((BuilderCodeTree) treeToAdd, true).end(); } else { BuilderCodeTree tree = new BuilderCodeTree(currentElement, GROUP, null, null); currentElement.add(treeToAdd); return push(tree, true).end(); } } return this; }
public CodeExecutableElement(Set<Modifier> modifiers, TypeMirror returnType, String name, CodeVariableElement... parameters) { super(modifiers); this.returnType = returnType; this.name = CodeNames.of(name); for (CodeVariableElement codeParameter : parameters) { addParameter(codeParameter); } }
@Override public String toString() { StringBuilderCodeWriter codeWriter = new StringBuilderCodeWriter(); accept(codeWriter, null); return codeWriter.getString(); }
private void clearLast(CodeTreeKind kind) { if (clearLastRec(kind, currentElement.getEnclosedElements())) { treeCount--; } else { // delay clearing the last BuilderCodeTree tree = new BuilderCodeTree(currentElement, REMOVE_LAST, null, null); tree.removeLast = kind; push(tree, false); } }
public CodeTreeBuilder end() { BuilderCodeTree tree = currentElement; EndCallback callback = tree.getAtEndListener(); if (callback != null) { callback.beforeEnd(); toParent(); callback.afterEnd(); } else { toParent(); } return this; }
private CodeAnnotationMirror createUnusedAnnotationMirror() { CodeAnnotationMirror mirror = new CodeAnnotationMirror(unusedAnnotation); mirror.setElementValue(mirror.findExecutableElement("value"), new CodeAnnotationValue("unused")); return mirror; }
@Override public Element getEnclosingElement() { if (isTopLevelClass()) { return packageElement; } else { return super.getEnclosingElement(); } }
@Override public void setEnclosingElement(Element element) { super.setEnclosingElement(element); // update qualified name on container change this.qualifiedName = createQualifiedName(); }
public void visitTree(CodeTree e, P p, Element parent) { List<CodeTree> elements = e.getEnclosedElements(); if (elements != null) { for (CodeTree tree : e.getEnclosedElements()) { visitTree(tree, p, parent); } } }
public CodeTreeBuilder getBuilder() { CodeTree tree = this.bodyTree; return createBuilder().tree(tree); }
private CodeTreeBuilder push(String string) { return push(new BuilderCodeTree(currentElement, CodeTreeKind.STRING, null, string), false); }
public CodeTreeBuilder tree(CodeTree treeToAdd) { if (treeToAdd instanceof BuilderCodeTree) { return push((BuilderCodeTree) treeToAdd, true).end(); } else { BuilderCodeTree tree = new BuilderCodeTree(currentElement, GROUP, null, null); currentElement.add(treeToAdd); return push(tree, true).end(); } }
private void clearLast(CodeTreeKind kind) { if (clearLastRec(kind, currentElement.getEnclosedElements())) { treeCount--; } else { // delay clearing the last BuilderCodeTree tree = new BuilderCodeTree(currentElement, REMOVE_LAST, null, null); tree.removeLast = kind; push(tree, false); } }
public CodeTreeBuilder end() { BuilderCodeTree tree = currentElement; EndCallback callback = tree.getAtEndListener(); if (callback != null) { callback.beforeEnd(); toParent(); callback.afterEnd(); } else { toParent(); } return this; }
private CodeAnnotationMirror createUnusedAnnotationMirror() { CodeAnnotationMirror mirror = new CodeAnnotationMirror(unusedAnnotation); mirror.setElementValue(mirror.findExecutableElement("value"), new CodeAnnotationValue("unused")); return mirror; }
@Override public String toString() { StringBuilderCodeWriter codeWriter = new StringBuilderCodeWriter(); accept(codeWriter, null); return codeWriter.getString(); }
public CodeExecutableElement(Set<Modifier> modifiers, TypeMirror returnType, String name, CodeVariableElement... parameters) { super(modifiers); this.returnType = returnType; this.name = CodeNames.of(name); for (CodeVariableElement codeParameter : parameters) { addParameter(codeParameter); } }
@Override public Element getEnclosingElement() { if (isTopLevelClass()) { return packageElement; } else { return super.getEnclosingElement(); } }
@Override public void setEnclosingElement(Element element) { super.setEnclosingElement(element); // update qualified name on container change this.qualifiedName = createQualifiedName(); }
public void visitTree(CodeTree e, P p, Element parent) { List<CodeTree> elements = e.getEnclosedElements(); if (elements != null) { for (CodeTree tree : e.getEnclosedElements()) { visitTree(tree, p, parent); } } }