Check if a type is an interface
You have got a Class#isInterface()
method that does exactly what you want: -
if (!interfaceType.isInterface()) {
throw...
}
Just use Class#isInterface()
to check that
And seriously, you should be reading the Javadocs before asking here.