How to create different types of objects and literals using Eclipse AST?
ie To create primitives like 'c', 1, 1.5f
. To create objects literals like new Employee('str')
You have to use AST
class, here's a documentation for it.
For example creating a StringLiteral
which contains Hello World
phrase.
AST ast = newAST(AST.JLS4)
StringLiteral literal = ast.newStringLiteral();
literal.setLiteralValue("Hello World");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.