public Template<T> replaceExpression(String placeholder, Node replacement) { return replaceExpression(placeholder, replacement, null); }
public Template<T> replaceIdentifier(String placeholder, String replacement) { return replaceIdentifier(placeholder, replacement, null); }
public Template<T> replaceStatement(String placeholder, Node replacement) { return replaceStatement(placeholder, replacement, null); }
public static Statement parseStatement(String source) throws AstException { Source s = new Source(source, "statementSnippet"); s.parseStatement(); return process(s, "statement", Statement.class); }
/** * NB: Do not simply pass the result of {@code parseX} to this method; parsing is extremely slow. Instead, parse a template once, * and then pass this one result every time. The template will never modify the original. */ @SuppressWarnings("unchecked") public static <N extends Node> Template<N> of(N source) throws AstException { return new Template<N>((N) source.copy()); }
public Template<T> replaceTypeReference(String placeholder, Node replacement) { return replaceTypeReference(placeholder, replacement, null); }
public static VariableDeclaration parseField(String source) throws AstException { Source s = new Source(source, "fieldSnippet"); s.parseMember(); return process(s, "field", VariableDeclaration.class); }
/** * NB: Do not simply pass the result of {@code parseX} to this method; parsing is extremely slow. Instead, parse a template once, * and then pass this one result every time. The template will never modify the original. */ @SuppressWarnings("unchecked") public static <N extends Node> Template<N> of(N source) throws AstException { return new Template<N>((N) source.copy()); }
public Template<T> replaceTypeReference(String placeholder, Node replacement) { return replaceTypeReference(placeholder, replacement, null); }
public static VariableDefinition parseVariableDefinition(String source) throws AstException { Source s = new Source(source, "vardefSnippet"); s.parseMember(); return process(s, "vardef", VariableDefinition.class); }
public Template<T> replaceStatement(String placeholder, List<? extends Node> replacement) { return replaceStatement(placeholder, replacement, null); }
/** * NB: Do not simply pass the result of {@code parseX} to this method; parsing is extremely slow. Instead, parse a template once, * and then pass this one result every time. The template will never modify the original. */ @SuppressWarnings("unchecked") public static <N extends Node> Template<N> of(N source) throws AstException { return new Template<N>((N) source.copy()); }
public Template<T> replaceTypeReference(String placeholder, Node replacement) { return replaceTypeReference(placeholder, replacement, null); }
public Template<T> replaceExpression(String placeholder, Node replacement) { return replaceExpression(placeholder, replacement, null); }
public Template<T> replaceIdentifier(String placeholder, String replacement) { return replaceIdentifier(placeholder, replacement, null); }
public static MethodDeclaration parseMethod(String source) throws AstException { Source s = new Source(source, "methodSnippet"); s.parseMember(); return process(s, "method", MethodDeclaration.class); }
public Template<T> replaceStatement(String placeholder, Node replacement) { return replaceStatement(placeholder, replacement, null); }
public Template<T> replaceExpression(String placeholder, Node replacement) { return replaceExpression(placeholder, replacement, null); }
public Template<T> replaceIdentifier(String placeholder, String replacement) { return replaceIdentifier(placeholder, replacement, null); }
public static MethodDeclaration parseMethod(String source) throws AstException { Source s = new Source(source, "methodSnippet"); s.parseMember(); return process(s, "method", MethodDeclaration.class); }