Centralized mechanism of turning objects to and from basic String representation. Used extensively by the arguments infrastructure for getting and setting argument values.
This package provides a replacement for the builtin
obj.toString()
method - instead use
Stringify.toString(obj)
which will use a registered
ToStringer
, falling back to obj.toString()
when necessary. Similarly, we can get back an object from a String
by calling Stringify.fromString(type, string).
You can register or override the stringification methods by associating your own instances of Stringify.ToString<T> and Stringify.FromString<T> with a particular type T.