Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would it interesting to be able produce strings from the type instances? #13

Open
Elisedlund opened this issue Apr 24, 2014 · 3 comments

Comments

@Elisedlund
Copy link

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>(){});
}

@drapostolos
Copy link
Owner

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?

@Elisedlund
Copy link
Author

yes.

@drapostolos
Copy link
Owner

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants