Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Get generic type of class at runtime

public class GenericClass<T> {

     private final Class<T> type;

     public GenericClass(Class<T> type) {
          this.type = type;
     }

     public Class<T> getMyType() {
         return this.type;
     }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Get #generic #type #class #runtime
ADD COMMENT
Topic
Name
5+5 =