type-parser
type-parser copied to clipboard
Would it interesting to be able produce strings from the type instances?
Right now there's support for de-serializing types from a string, Would it be interesting to also be able to produce(by serializing) these strings from the type instances? parser.toString(listWithInt) parser.toString(listWithBoolean) parser.toString(mapOfStrings)
example/usecase: saveState { savedState = parser.toString(mapOfStrings) }
loadState { mapOfStrings = parser.parse(savedState,new GenericType<Map<String,String>(){}); }
Good question! You mean like for List the parser.toString() would strip off the trailing square brackets [] when calling List.toString(), so it can be parsed back again?
yes.
I was thinking such serializing functionality could be put in a separate library (perhaps with a dependency towards type-parser?), to avoid increasing the foot-print of the TypeParser library (So the users of only the parse functionality should not be forced to include the code for serializing as well).