dimanche 23 juin 2019

how to get class list of primitive values from string array

i have list of String, contains value of different primitive types as string like: String[] types = {"String","int"};

i need to get array of classes:

Class[] classList;
classList[0] = types[0].Class // String.Class
classList[1] = types[1].Class // int.class

how i can get the class of "String" and "int"

tries this:

Class<?>[] params = new Class[3];
for(int i = 0 ; i < typesSet.length ; i++){
params[i] = Class.forName(typesSet[i]);
}





Aucun commentaire:

Enregistrer un commentaire