4 ms·
So you've never had to do byte code manipulation or other weird things like another commentor said?
by ianai 10y ago
So you've never had to do byte code manipulation or other weird things like another commentor said?
- andrewaylett 10y agoAppropriate magic. Jackson uses byte-code manipulation to get its work done, but you'll never see it nor have to interact with it -- all you see is a nicely annotated class that automatically converts to and from JSON as it enters and leaves your code. For advanced use-cases you may have to ask for the ObjectMapper and convert strings yourself, but you'll never need to know how it's implemented. To my mind, appropriate magic is where you define your interface to have a simple-to-use but complete API, hiding the complexity of implementation. For example, Guava's CacheMap implementation has careful internal locking to present a consistent but high-performance thread-safe object, rather than requiring external locking or needing the caller to avoid certain combinations of actions, both of which I've seen when I've come across people who tried to implement their own. Or, in Jackson's case, high-performance data manipulation that could be done using reflection but isn't because that would be too slow.
- foxylion 10y agoThat's really not necessary. I don't know where this comes from, but we maintain a big Java application and never messed with the byte code. Dropwizard itself is a very mature framework an extremly easy to get started with.
- allengeorge 10y agoByte-code manipulation?! No - never. I'm not sure where that comes from. I've had to write my custom ObjectMappers for JSON and some glue mappers for JDBI - but they were pretty lightweight. In fact, I've some examples in github of a custom key-value server written using Dropwizard with examples of those...