Skip to content

How to use stringbuilder in transform #5136

Answered by jonbartels
rutledj asked this question in Q&A
Discussion options

You must be logged in to vote

Try this:

var strBuilder = new java.lang.StringBuilder();
   strBuilder.append('Hello");
   logger.info(strBuilder.toString());

Poorly worded explanation: The error is because the JS -> Java engine, Rhino, is trying to figure out what to do with strBuilder to cast it to a string type for logger.info. strBuilder has a toString method but it's also a StringBuilder object. Rhino is saying it can't figure out what to do, so you have to be explicit.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tonygermano
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants