1

I'm working with JSON data and converting it into Java POJO class, then I built an interface like this:

public interface DataUtil<T extends DataUtil<T>> {
    default T someDefaultFn() { ... };
}

And I used this interface for some POJO data class like:

public MyPoJo extends DataUtil<MyPojo> { ... }

And I get stuck when I to try check the type variable Class<FType> (a FieldType of any fields are declared inside T class) whether FType extends DataUtil<FType extends DataUtil<FType>> or not? I'm also trying to research the java.reflect package but did not find the expected answer. Can anyone help me to resolve this problem or find another design solution for this scenario?

Tom
  • 16,842
  • 17
  • 45
  • 54
  • 5
    Does this help you: https://stackoverflow.com/questions/766106/test-if-object-implements-interface ? If not, could you explain why that doesn't work for you so I can try to help you? – Breus May 19 '20 at 15:22

0 Answers0