No, don't. (type instanceof ContentInputStream) is always false, because (type instanceof Class<?>) is always true. And thanks to type erasure, (type instanceof Class<ContentInputStream>) is not useful. == is the best you can do.