Is there a Java method that works like Python\'s repr? For example, assuming the function were named repr,
\"foo\\n\\tbar\".repr()
would re
It appears that Jython already does this. You could, in theory, include the Jython jar, startup an interpreter, and actually run repr(object) on the object in question. Probably more overhead than you want, but does exactly what you describe.
If you want to embed the Jython interpreter in your application, consider http://wiki.python.org/jython/JythonFaq/EmbeddingJython .