March 16th, 2020
- java
- Something to watch out for in future when trying to get the parameterized type from a class, i.e the
SomeOtherClassfromClass<SomeOtherClass>- Getting the type is easy, especially if you only have one type:
- Something to watch out for in future when trying to get the parameterized type from a class, i.e the
| |
- Watch out for calling
Type.getClass()as you will not get the class you were expecting, but the class that represents the instance of theTypeclassTypeitself is an interfaces thatClassimplements, so it should be OK to pass the type instance to places you would pass classes