vendredi 20 mars 2015

create ArrrayList from Type in java

Why this is not possible ?



Type type = newResponse.getDataType().getType();
Class<?> tClass = type.getClass();
Type arrayType = new TypeToken<ArrayList<tClass>>(){}.getType();


This trows -



Error:(36, 54) error: cannot find symbol class tClass


Enum that returns Type is as follows -



public enum DataType{
@SerializedName("user")
USER(User.class);

Type type;

DataType(Type type) {
this.type = type;
}

public Type getType(){
return type;
}
}





Aucun commentaire:

Enregistrer un commentaire