L
L
Loligan2015-07-15 13:30:49
Java
Loligan, 2015-07-15 13:30:49

Where is reflection used in practice? Why might it be needed in principle when writing a project?

Where is reflection used in practice? Why might it be needed in principle when writing a project?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evhen, 2015-07-15
@Loligan

Reflection is a tool with which you can find out all the information about a class: method names, parameters, fields, annotations, etc.
These features are widely used in frameworks like Spring, Hibernate...
Various json/xml serializers

P
programmerjava, 2015-07-16
@programmerjava

Anything that uses annotations already uses reflection. There is also a subtle thing that few people know - a proxy. You can programmatically wrap a method and do actions before and after. If I don’t sleep and haven’t forgotten, then this is actively used as a base for aspects.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question