MDLV2000Writer 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 (IAtomContainer.class.equals(classObject)) return true; if (IChemFile.class.equals(classObject)) return true; if (IChemModel.class.equals(classObject)) return true; Class superClass = classObject.getSuperclass(); if (superClass != null) return this.accepts(superClass); return false; } MDLV2000Writer(Writer out);  MDLV2000Writer(OutputStream output);  MDLV2000Writer(); @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 writeMolecule(IAtomContainer container); void setWriteAromaticBondTypes(boolean val); void customizeJob(); static final String OptForceWriteAs2DCoordinates; static final String OptWriteMajorIsotopes; static final String OptWriteAromaticBondTypes; static final String OptWriteQueryFormatValencies; static final String OptWriteDefaultProperties; static final String OptProgramName; }
@Test public void testAccepts() throws Exception { MDLV2000Writer reader = new MDLV2000Writer(); Assert.assertTrue(reader.accepts(ChemFile.class)); Assert.assertTrue(reader.accepts(ChemModel.class)); Assert.assertTrue(reader.accepts(AtomContainer.class)); }