@Test public void testIsCollection_ParameterizedType() throws NoSuchMethodException { var type = TestJavaTypeInspector.class.getMethod("test1").getGenericReturnType(); assertTrue(_typeInspector.isCollection(type)); }
@Override public boolean isCollection(Type type) { if (type instanceof Class) { var clazz = (Class)type; if (clazz.isArray()) { return true; } if (Collection.class.isAssignableFrom(clazz)) { return true; } } else if (type instanceof ParameterizedType) { return isCollection(((ParameterizedType) type).getRawType()); } return false; }
JavaTypeInspector implements ITypeInspector { @Override public boolean isCollection(Type type) { if (type instanceof Class) { var clazz = (Class)type; if (clazz.isArray()) { return true; } if (Collection.class.isAssignableFrom(clazz)) { return true; } } else if (type instanceof ParameterizedType) { return isCollection(((ParameterizedType) type).getRawType()); } return false; } }
JavaTypeInspector implements ITypeInspector { @Override public boolean isCollection(Type type) { if (type instanceof Class) { var clazz = (Class)type; if (clazz.isArray()) { return true; } if (Collection.class.isAssignableFrom(clazz)) { return true; } } else if (type instanceof ParameterizedType) { return isCollection(((ParameterizedType) type).getRawType()); } return false; }  }
JavaTypeInspector implements ITypeInspector { @Override public boolean isCollection(Type type) { if (type instanceof Class) { var clazz = (Class)type; if (clazz.isArray()) { return true; } if (Collection.class.isAssignableFrom(clazz)) { return true; } } else if (type instanceof ParameterizedType) { return isCollection(((ParameterizedType) type).getRawType()); } return false; }  @Override boolean isSimpleType(Type type); @Override boolean isCollection(Type type); @Override Type getCollectionComponentType(Type type); @Override boolean isSupport(Type type); }
JavaTypeInspector implements ITypeInspector { @Override public boolean isCollection(Type type) { if (type instanceof Class) { var clazz = (Class)type; if (clazz.isArray()) { return true; } if (Collection.class.isAssignableFrom(clazz)) { return true; } } else if (type instanceof ParameterizedType) { return isCollection(((ParameterizedType) type).getRawType()); } return false; }  @Override boolean isSimpleType(Type type); @Override boolean isCollection(Type type); @Override Type getCollectionComponentType(Type type); @Override boolean isSupport(Type type);  }