Answers for "get object's generic class"

1

get class from generic type java

class Foo<T> {
    final Class<T> typeParameterClass;

    public Foo(Class<T> typeParameterClass) {
        this.typeParameterClass = typeParameterClass;
    }

    public void bar() {
        // you can access the typeParameterClass here and do whatever you like
    }
Posted by: Guest on June-04-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language