0

** Not a duplicate as it is specific to method and not a class **

I am using some third party library which accepts class object as parameter. I want to get class object of generic type method in Java -

Please note that my class is not generic only one of the method is generic.

public class DataAccessor {
    public <T> Page<T> getPage(final Integer pageIndex) {
        // ...
        // Some processing
        // ...

        // Third-part library which accepts Class as parameter
        Object respponse = library.getPage(pageIndex, <Class object T ???>);        

        // ...
        // Some processing
        // ...
    }
}

How to get such class type if my class is not generic?

Parag Meshram
  • 8,281
  • 10
  • 52
  • 88

0 Answers0