SDFWriter extends DefaultChemObjectWriter { @Override public boolean accepts(Class<? extends IChemObject> classObject) { Class<?>[] interfaces = classObject.getInterfaces(); for (int i = 0; i < interfaces.length; i++) { if (IAtomContainer.class.equals(interfaces[i])) return true; if (IChemFile.class.equals(interfaces[i])) return true; if (IChemModel.class.equals(interfaces[i])) return true; if (IAtomContainerSet.class.equals(interfaces[i])) return true; } if (IAtomContainer.class.equals(classObject)) return true; if (IChemFile.class.equals(classObject)) return true; if (IChemModel.class.equals(classObject)) return true; if (IAtomContainerSet.class.equals(classObject)) return true; Class superClass = classObject.getSuperclass(); if (superClass != null) return this.accepts(superClass); return false; } SDFWriter(BufferedWriter wtr);  SDFWriter(Writer wtr);  SDFWriter(OutputStream output);  SDFWriter();  SDFWriter(Writer out, Set<String> propertiesToWrite);  SDFWriter(OutputStream output, Set<String> propertiesToWrite);  SDFWriter(Set<String> propertiesToWrite); @Override IResourceFormat getFormat(); @Override void setWriter(Writer out); @Override void setWriter(OutputStream output); @Override void close(); @Override boolean accepts(Class<? extends IChemObject> classObject); @Override void write(IChemObject object); void setAlwaysV3000(boolean val); void customizeJob(); static final String OptAlwaysV3000; static final String OptWriteData; static final String OptTruncateLongData; }
@Test public void testAccepts() throws Exception { SDFWriter reader = new SDFWriter(); Assert.assertTrue(reader.accepts(ChemFile.class)); Assert.assertTrue(reader.accepts(ChemModel.class)); Assert.assertTrue(reader.accepts(AtomContainerSet.class)); }