mardi 25 août 2015

Instance of GenericArrayType interface

class ReflectionClass{
   public static void anyMethod(Type type){
      if(type instanceof GenericArraytype){
         // some code
      }
   } 
}
class Client{
   public static void main(String[] args){
      anyMethod(...);
   }
}

I'm trying to receive a "true" value in if(type instanceof GenericArraytype) statement.

So, what I should put as an argument into invocation of anyMethod method inside Client class?

From the Oracle Documentation about GenericArrayType interface:

GenericArrayType represents an array type whose component type is either a parameterized type or a type variable.

But, I also know that I can't create arrays of parameterized types from here

Thus, how can I achieve this?





Aucun commentaire:

Enregistrer un commentaire