I want to validate a parameter sent to a method, it must be an interface type. What to ask?
void (Class<I> interfaceType){
if (thisisnotaninterface){
throw...
}
}
I want to validate a parameter sent to a method, it must be an interface type. What to ask?
void (Class<I> interfaceType){
if (thisisnotaninterface){
throw...
}
}
Just use
Class#isInterface()
to check thatAnd seriously, you should be reading the Javadocs before asking here.
You have got a
Class#isInterface()
method that does exactly what you want: -