@Override public MethodSource<Body> addMethod(Method<?, ?> method) { MethodSource<Body> m = new MethodImpl<Body>(this, method.toString()); getBody().bodyDeclarations().add(m.getInternal()); return m; }
@Override @SuppressWarnings("unchecked") public MethodSource<O> addMethod(Method<?, ?> method) { MethodSource<O> m = new MethodImpl<>((O) this, method.toString()); getDeclaration().bodyDeclarations().add(m.getInternal()); return m; }
@Override public MethodSource<Body> addMethod(Method<?, ?> method) { MethodSource<Body> m = new MethodImpl<Body>(this, method.toString()); getBody().bodyDeclarations().add(m.getInternal()); return m; }
@Override @SuppressWarnings("unchecked") public MethodSource<O> addMethod() { MethodSource<O> m = new MethodImpl<>((O) this); getDeclaration().bodyDeclarations().add(m.getInternal()); return m; }
@Override public MethodSource<Body> addMethod() { final MethodSource<Body> m = new MethodImpl<Body>(this); getBody().bodyDeclarations().add(m.getInternal()); return m; }
@Override public MethodSource<Body> addMethod(java.lang.reflect.Method method) { final MethodSource<Body> m = new MethodImpl<Body>(this, method); getBody().bodyDeclarations().add(m.getInternal()); return m; }
@Override public MethodSource<Body> addMethod(final String method) { final MethodSource<Body> m = new MethodImpl<Body>(this, method); getBody().bodyDeclarations().add(m.getInternal()); return m; }
@Override @SuppressWarnings("unchecked") public MethodSource<O> addMethod(final String method) { MethodSource<O> m = new MethodImpl<>((O) this, method); getDeclaration().bodyDeclarations().add(m.getInternal()); return m; }
@Override @SuppressWarnings("unchecked") public MethodSource<O> addMethod(java.lang.reflect.Method method) { MethodSource<O> m = new MethodImpl<O>((O) this, method); getBodyDeclaration().bodyDeclarations().add(m.getInternal()); return m; }
@Override @SuppressWarnings("unchecked") public MethodSource<O> addMethod(final String method) { MethodSource<O> m = new MethodImpl<O>((O) this, method); getBodyDeclaration().bodyDeclarations().add(m.getInternal()); return m; }
@Override public MethodSource<Body> addMethod(final String method) { final MethodSource<Body> m = new MethodImpl<Body>(this, method); getBody().bodyDeclarations().add(m.getInternal()); return m; }
@Override public MethodSource<Body> addMethod(java.lang.reflect.Method method) { final MethodSource<Body> m = new MethodImpl<Body>(this, method); getBody().bodyDeclarations().add(m.getInternal()); return m; }
@Override @SuppressWarnings("unchecked") public MethodSource<O> addMethod(java.lang.reflect.Method method) { MethodSource<O> m = new MethodImpl<>((O) this, method); getDeclaration().bodyDeclarations().add(m.getInternal()); return m; }
@Override @SuppressWarnings("unchecked") public MethodSource<O> addMethod(final String method) { MethodSource<O> m = new MethodImpl<O>((O) this, method); getBodyDeclaration().bodyDeclarations().add(m.getInternal()); return m; }
@Override @SuppressWarnings("unchecked") public MethodSource<Body> addMethod(final String method) { final MethodSource<Body> m = new MethodImpl<Body>(this, method); getBody().bodyDeclarations().add(m.getInternal()); return m; }
@Override @SuppressWarnings("unchecked") public MethodSource<O> addMethod() { MethodSource<O> m = new MethodImpl<O>((O) this); getBodyDeclaration().bodyDeclarations().add(m.getInternal()); return m; }
public MethodImpl(final O parent, final String method) { init(parent); String stub = "public class Stub { " + method + " }"; JavaClassSource temp = (JavaClassSource) Roaster.parse(stub); List<MethodSource<JavaClassSource>> methods = temp.getMethods(); MethodDeclaration newMethod = (MethodDeclaration) methods.get(0).getInternal(); MethodDeclaration subtree = (MethodDeclaration) ASTNode.copySubtree(cu.getAST(), newMethod); this.method = subtree; }
public TypeImpl(final O origin, final Type<O> parent, final String type) { init(origin); this.parent = parent; String stub = "public class Stub { private " + type + " getType(){return null;} }"; JavaClassSource temp = (JavaClassSource) Roaster.parse(stub); List<MethodSource<JavaClassSource>> methods = temp.getMethods(); MethodDeclaration newMethod = (MethodDeclaration) methods.get(0).getInternal(); org.eclipse.jdt.core.dom.Type subtree = (org.eclipse.jdt.core.dom.Type) ASTNode.copySubtree(cu.getAST(), newMethod.getReturnType2()); this.type = subtree; }
public TypeImpl(final O origin, final Type<O> parent, final String type) { init(origin); this.parent = parent; String stub = "public class Stub { private " + type + " getType(){return null;} }"; JavaClassSource temp = (JavaClassSource) Roaster.parse(stub); List<MethodSource<JavaClassSource>> methods = temp.getMethods(); MethodDeclaration newMethod = (MethodDeclaration) methods.get(0).getInternal(); org.eclipse.jdt.core.dom.Type subtree = (org.eclipse.jdt.core.dom.Type) ASTNode.copySubtree(cu.getAST(), newMethod.getReturnType2()); this.type = subtree; }
@Override public MethodSource<O> setBody(final String body) { String stub = "public class Stub { public void method() {" + body + "} }"; JavaClassSource temp = (JavaClassSource) Roaster.parse(stub); List<MethodSource<JavaClassSource>> methods = temp.getMethods(); Block block = ((MethodDeclaration) methods.get(0).getInternal()).getBody(); block = (Block) ASTNode.copySubtree(method.getAST(), block); method.setBody(block); return this; }