0

If I have class CalendarModel to get class I use CalendarModel.class . But how when I have list of model? Something like List < CalendarModel>.class

This is context in my app in which I need that: Android easy cache requires that thing https://github.com/vincentbrison/android-easy-cache

  DualCache<AbstractVehicule> cache = new DualCacheBuilder<AbstractVehicule>(CACHE_NAME, TEST_APP_VERSION, AbstractVehicule.class)
                                               .useDefaultSerializerInRam(RAM_MAX_SIZE)
                                               .noDisk();

How to write this if I want to cache list of AbstractVehicule?

EDIT: Maybe this is solution: (Class< List< AbstractVehicule >>)(Class<?>)List.class

Tom Hawtin - tackline
  • 145,806
  • 30
  • 211
  • 305
Vlado Pandžić
  • 4,879
  • 8
  • 44
  • 75
  • I think this is what you want: http://stackoverflow.com/questions/2390662/java-how-do-i-get-a-class-literal-from-a-generic-type – OneCricketeer Apr 29 '16 at 22:03

1 Answers1

1

I think you could just specify List.class?

Michael Payne
  • 534
  • 5
  • 13