multiline string/string literal without escape processing

Rémi Forax forax at univ-mlv.fr
Sun Aug 21 07:45:58 PDT 2011


On 08/21/2011 12:48 PM, saeed yousefi wrote:
> Hi
>
> Yes , I know I can put the text into external resources but it doesn't mean that there shouldn't be such facility in the language itself . 
> so for what strings exist ? There are lots of places where I want to return a short JSON response from server and I can do it with this feature.
>
>
> regards
>
> saeed

Why not using a lib for that ?
http://stackoverflow.com/questions/338586/a-better-java-json-library

After all this is one of the great force of Java,
you want to do something in Java, there is an app lib for that.

Rémi

> ________________________________
> From: Tom Ball<tball at google.com>
> To: saeed yousefi<saeedtej at yahoo.com>
> Cc: "coin-dev at openjdk.java.net"<coin-dev at openjdk.java.net>
> Sent: Sunday, August 21, 2011 4:21 AM
> Subject: Re: multiline string/string literal without escape processing
>
>
> There's a great language you should considering using that has built-in support for JS and JSON:  JavaScript.  Just because something can be written in Java doesn't mean that it necessarily should, as real engineers write code in the language most appropriate for the task before them (IMO).
>
>
> Another option is to put the text you're currently laboriously escaping into external resource files, and just read them in as needed.  The advantage to keeping text in different files is that most editors and IDEs provide syntax-specific formatting, which makes it easier to write and mades errors easier to spot.  JSON?  Use a library to convert your data types instead of doing it by hand, as the overhead is minimal.  Write unit tests for those data classes and you have a much more robust solution that scales much better than hand editing.
>
> Tom
>




More information about the coin-dev mailing list