/** * Takes an object which subclasses IChemObject, e.g. Molecule, and will read * this (from file, database, internet etc). If the specific implementation * does not support a specific IChemObject it will throw an Exception. * *@param object The object that subclasses * IChemObject *@return The IChemObject read *@exception CDKException */ @Override public <T extends IChemObject> T read(T object) throws CDKException { if (object instanceof IChemFile) { return (T) readChemFile((IChemFile) object); } else if (object instanceof IChemModel) { return (T) readChemModel((IChemModel) object); } else if (object instanceof IAtomContainer) { return (T) readMolecule((IAtomContainer) object); } else { throw new CDKException("Only supported are ChemFile and Molecule."); } }