# Uses of Class
org.eclipse.jdt.core.dom.AST

Packages that use AST
Package
Description
org.eclipse.jdt.core.dom
The Java DOM/AST is the set of classes that model the source code of a Java program as a structured document.
org.eclipse.jdt.core.dom.rewrite
The Java DOM/AST rewrite is the set of classes that are used to make changes to an existing DOM/AST tree.

## Uses of AST in org.eclipse.jdt.core.dom

Methods in org.eclipse.jdt.core.dom that return AST
Modifier and Type
Method
Description
`final AST`
ASTNode.`getAST()`
Returns this node's AST.
`static AST`
AST.`newAST(int level)`
Deprecated.
Clients should port their code to use the latest JLS* AST API and call `AST.newAST(AST.JLS12, false)` instead of using this constructor.
`static AST`
AST.`newAST(int level, boolean previewEnabled)`
Creates a new Java abstract syntax tree (AST) following the specified set of API rules.
`static AST`
AST.`newAST(Map<String,String> options)`
Creates a new Java abstract syntax tree Following option keys are significant: `"org.eclipse.jdt.core.compiler.source"` indicates the api level and source compatibility mode (as per `JavaCore`) - defaults to 1.3 `"1.3"` means the source code is as per JDK 1.3 and api level `JLS3`. `"1.4", "1.5", "1.6", "1.7" "1.8"` implies the respective source JDK levels 1.4, 1.5, 1.6, 1.7 and api level `JLS4`. `"1.8"` implies the respective source JDK level 1.8 and api level `JLS8`. `"9", "10", "11", "12" and "13"` implies the respective JDK levels 9, 10, 11, 12 and 13 and api levels `JLS9`, `JLS10`, `JLS11`, `JLS12` and `JLS13`. Additional legal values may be added later. `"org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures"` - indicates whether the preview is enabled or disabled legal values are `"enabled"` and `"disabled"` implying preview enabled and disabled respectively.
Methods in org.eclipse.jdt.core.dom with parameters of type AST
Modifier and Type
Method
Description
`protected ASTNode`
ModulePackageAccess.`cloneHelper(AST target, ModulePackageAccess result)`
`static ASTNode`
ASTNode.`copySubtree(AST target, ASTNode node)`
Returns a deep copy of the subtree of AST nodes rooted at the given node.
`static List`
ASTNode.`copySubtrees(AST target, List nodes)`
Returns a deep copy of the subtrees of AST nodes rooted at the given list of nodes.

## Uses of AST in org.eclipse.jdt.core.dom.rewrite

Methods in org.eclipse.jdt.core.dom.rewrite that return AST
Modifier and Type
Method
Description
`final AST`
ASTRewrite.`getAST()`
Returns the AST the rewrite was set up on.
Methods in org.eclipse.jdt.core.dom.rewrite with parameters of type AST
Modifier and Type
Method
Description
`Annotation`
ImportRewrite.`addAnnotation(IAnnotationBinding annotation, AST ast, ImportRewrite.ImportRewriteContext context)`
Adds the necessary imports for the given annotation binding to the rewriter's record and returns an `Annotation` that can be used in the code.
`Type`
ImportRewrite.`addImport(ITypeBinding binding, AST ast)`
Adds a new import to the rewriter's record and returns a `Type` that can be used in the code.
`Type`
ImportRewrite.`addImport(ITypeBinding binding, AST ast, ImportRewrite.ImportRewriteContext context)`
Adds a new import to the rewriter's record and returns a `Type` that can be used in the code.
`Type`
ImportRewrite.`addImport(ITypeBinding binding, AST ast, ImportRewrite.ImportRewriteContext context, ImportRewrite.TypeLocation location)`
Adds a new import to the rewriter's record and returns a `Type` that can be used in the code.
`Type`
ImportRewrite.`addImportFromSignature(String typeSig, AST ast)`
Adds a new import to the rewriter's record and returns a `Type` node that can be used in the code as a reference to the type.
`Type`
ImportRewrite.`addImportFromSignature(String typeSig, AST ast, ImportRewrite.ImportRewriteContext context)`
Adds a new import to the rewriter's record and returns a `Type` node that can be used in the code as a reference to the type.
`static ASTRewrite`
ASTRewrite.`create(AST ast)`
Creates a new instance for describing manipulations of the given AST.
Constructors in org.eclipse.jdt.core.dom.rewrite with parameters of type AST
Modifier
Constructor
Description
`protected`
`ASTRewrite(AST ast)`
Internal constructor.