PMPReader extends DefaultChemObjectReader { @Override @SuppressWarnings("unchecked") public boolean accepts(Class<? extends IChemObject> classObject) { if (IChemFile.class.equals(classObject)) return true; Class<?>[] interfaces = classObject.getInterfaces(); for (Class<?> anInterface : interfaces) { if (IChemFile.class.equals(anInterface)) return true; } Class superClass = classObject.getSuperclass(); if (superClass != null) return this.accepts(superClass); return false; } PMPReader(Reader input);  PMPReader(InputStream input);  PMPReader(); @Override IResourceFormat getFormat(); @Override void setReader(Reader input); @Override void setReader(InputStream input); @Override @SuppressWarnings("unchecked") boolean accepts(Class<? extends IChemObject> classObject); @Override @SuppressWarnings("unchecked") T read(T object); @Override void close();  }
@Test public void testAccepts() { PMPReader reader = new PMPReader(); Assert.assertTrue(reader.accepts(ChemFile.class)); }