This class is not intended to be subclassed.
@since 3.0This class is not intended to be subclassed.
@since 3.0 @noinstantiate This class is not intended to be instantiated by clients. @noextend This class is not intended to be subclassed by clients.The following code snippet illustrated usage of this class:
Document document = new Document("<?php class X {} ?>"); ASTParser parser = ASTParser.newParser(AST.JLS3); parser.setSource(doc.get().toCharArray()); Program cu = (Program) parser.createAST(null); AST ast = cu.getAST(); MethodDeclaration md = ast.newMethodDeclaration(); md.setName(ast.newName("foo")); ASTRewrite rewriter = ASTRewrite.create(ast); ClassDeclaration td = (ClassDeclaration) cu.statements().get(0); ITrackedNodePosition tdLocation = rewriter.track(td); ListRewrite lrw = rewriter.getListRewrite(cu, Program.METHODS_PROPERTY); lrw.insertLast(md, null); TextEdit edits = rewriter.rewriteAST(document, null); UndoEdit undo = edits.apply(document); assert "<?php class X {\n function foo() { } \n } ?>".equals(doc.get().toCharArray());
This class is not intended to be subclassed.
@since 3.0
|
|