XYZReader extends DefaultChemObjectReader { @Override public boolean accepts(Class<? extends IChemObject> classObject) { if (IChemFile.class.equals(classObject)) return true; Class<?>[] interfaces = classObject.getInterfaces(); for (int i = 0; i < interfaces.length; i++) { if (IChemFile.class.equals(interfaces[i])) return true; } Class superClass = classObject.getSuperclass(); if (superClass != null) return this.accepts(superClass); return false; } XYZReader(Reader input);  XYZReader(InputStream input);  XYZReader(); @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); @Override void close();  }
@Test public void testAccepts() { XYZReader reader = new XYZReader(); Assert.assertTrue(reader.accepts(ChemFile.class)); }