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");