简体   繁体   中英

CRUD operations via annotations

I'm new to Java. Can somebody explain how to use annotations and reflection for code reuse? I want to make a simple console program that implements CRUD operations on JDBC via this technology.

If you are new to Java, you still have at least a couple thousand hours of coding (perhaps more) before you are experienced enough to write your own code that uses reflection paired with annotations to achieve code reuse (in a sane way). It is a very uncommon way of writing Java programs and - as such - it is mainly used in infrastructure code: libraries and frameworks. Even if some technology expects programmers to write their own annotations, (like in BVF or CDI), they are only used within the constraints of the framework.

There is little sense in writing annotation/reflection code before you have used many such libraries and have gathered enough experience as a user of such code. And when you do, you will not need to ask questions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM