/** * Returns {@code true} if {@code type} is a parameterized type and {@code false} otherwise. * * @param type the type to be evaluated * @return {@code true} if {@code type} is a parameterized type and {@code false} otherwise */ public static boolean isParameterizedType(PsiType type) { if (!(type instanceof PsiClassType)) { return false; } Boolean accepted = type.accept( new PsiTypeVisitor<Boolean>() { @Nullable @Override public Boolean visitClassType(PsiClassType classType) { return classType.getParameterCount() > 0; } }); return Boolean.TRUE.equals(accepted); }
@Override public <A> A accept(@NotNull PsiTypeVisitor<A> visitor) { return null; }
/** * Accept a visitor on the property type. * * @return the result returned by the visitor */ @Nullable public <T> T accept(PsiTypeVisitor<T> visitor) { return type.accept(visitor); }