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