I have a class which has an interface as member
Class A {
IProp property;
}
At runtime we assign property with one of the concrete classes implementing IProp
.
Say,
A a = new A();
a.property = new IPropImpl();
Now if I have object a
, I get the fields using reflection :
Field[] fields = a.getDeclaredFields();
But for field property
, the type is returned as IProp
. I want to get the concrete type which was assigned to it. ( There maybe multiple concrete types. I want to get the one which is assigned to the field).
Can anyone help me out ?