private static GridFormatFactorySpi getFactoryForObject(URL id, File file) { for (GridFormatFactorySpi spi : factories.values()) { // we know that the factory is avaiable final AbstractGridFormat format = (AbstractGridFormat) spi.createFormat(); if (file != null && format.accepts(file)) return spi; if (id != null && format.accepts(id)) return spi; } return null; }
private static AbstractGridFormat getFormatForObject(URL id, File file) { final GridFormatFactorySpi spi = getFactoryForObject(id, file); return spi != null ? (AbstractGridFormat) spi.createFormat() : null; }