Hello, i need help
Question: Get T info or name, who is T ?
I summarized all the code.... but the goal is to know which annotations T has
-----code for demo problem ----------------------
public class Xpto {}
public class class ModelHelper<T> {
public String getTclassName() {
String className = this.getName(); //OK for class
String tName = T.getName() //?!?!??!??!?; Problem !!!! how do i get T name?
return tName;
}
}
void maiin() {
ModelHelper<Xpto > modelHelper = new ModelHelper<>();
String className = modelHelper.getTclassName();
}
----------------------------------------
Note: I don't look for solutions like : "getTclassName(Class<T> clazz)" because the class "ModelHelper<T>" has an obligation to know who T is!!!
Thanks for help