mallet
mallet copied to clipboard
StringCodec.java
resolves: #13 Replaces StringCodec.groovy with StringCodec.java
I will also remove Encoder/Decoder, to save space and avoid confusing newcomers. I do not see when you would need only one of them, and high level users can type in the classname. If you disagree, rebase this commit out of the merge.
If common protocols are transferred from groovy scripts to statically typed implementations, that would be a step towards documentation.
For what it is worth, I created the groovy implementation to serve as an example of how to create your own ScriptHandlers. And it can absolutely be possible to have a StringDecoder or StringEncoder by itself. For example, a protocol that reads the name of an image, and responds with the image itself. It is absolutely true that many people will simply go with the StringCodec, though, which is why that was also provided. I think perhaps a better/bigger change might be to group symmetric codecs in one tab, and independent Encoders and Decoders in an adjacent tab? What do you think?
The best organisation may be by protocol, grouping into String, Http, Ssl etc.; provides a sensible organisation for the (future) docs too, and makes it easier to import an external set of Handlers for a protocol (which won't be stored here if the project ever reaches a large size); in short, scalable. I think again each class should be wrapped somehow to allow automation of the templates.