java - Retrieve values from class: custom methods or reflection? -


for take values ​​from class there primitive fields (no methods) list of key - value prefer use reflection (with dynamic iteration) or specific method return hashmap? prefer?

at moment there fifty classes or in future can grow twenty or thirty (in regime)

i reflection in case not necessary?

the reflection-based approach cleaner, because not require classes implement additional methods, , not liable maintain these methods when new fields added existing classes.

a hashmap-based approach not buy in terms of performance, because primitives must wrapped in objects inserted map - same way wrapped returned reflection-based calls.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -