public String generateJs ( final Settings settings , final String methodName ) { // 1. Create an empty map... final Map < String , Object > variables = initializeVariables ( settings . asSet ( ) ) ; // 4. Generate the js template with the map and the method name... final String stringTemplateContent = generateJavascriptTemplateContent ( variables , methodName ) ; // 5. Create the StringTextTemplate with the generated template... final StringTextTemplate stringTextTemplate = new StringTextTemplate ( stringTemplateContent ) ; // 6. Interpolate the template with the values of the map... stringTextTemplate . interpolate ( variables ) ; try { // 7. return it as String... return stringTextTemplate . asString ( ) ; } finally { try { stringTextTemplate . close ( ) ; } catch ( final IOException e ) { LOGGER . error ( e . getMessage ( ) , e ) ; } } }
Generate the javascript code .