Javascript language object model to generate javascript code programmatically from Java