code: public ResourceFormatGenerator getGeneratorForFileExtension(final File file) throws UnsupportedFormatException {
          String extension = file.getName().lastIndexOf(".") > 0 ? file.getName().substring(file.getName().lastIndexOf(
              ".") + 1) : null;
          if (null != extension) {
              return getGeneratorForFileExtension(extension);
          } else {
              throw new UnsupportedFormatException("Could not determine format for file: " + file.getAbsolutePath());
          }
      }
docs: Return a generator for a file, based on the file extension.
  
  @param file the file
  
  @return the generator found for the extension
  
  @throws UnsupportedFormatException if the file extension does not match an available generator, or if the file
  has no extension