code: public File save(Reflections reflections, String name) {
          if (name.endsWith("/")) {
              name = name.substring(0, name.length() - 1); //trim / at the end
          }
  
          //prepare file
          String filename = name.replace('.', '/').concat(".java");
          File file = prepareFile(filename);
  
          //get package and class names
          String packageName;
          String className;
          int lastDot = name.lastIndexOf('.');
          if (lastDot == -1) {
              packageName = "";
              className = name.substring(name.lastIndexOf('/') + 1);
          } else {
              packageName = name.substring(name.lastIndexOf('/') + 1, lastDot);
              className = name.substring(lastDot + 1);
          }
  
          //generate
          try {
              StringBuilder sb = new StringBuilder();
              sb.append("//generated using Reflections JavaCodeSerializer")
                      .append(" [").append(new Date()).append("]")
                      .append("\n");
              if (packageName.length() != 0) {
                  sb.append("package ").append(packageName).append(";\n");
                  sb.append("\n");
              }
              sb.append("public interface ").append(className).append(" {\n\n");
              sb.append(toString(reflections));
              sb.append("}\n");
  
              Files.write(sb.toString(), new File(filename), Charset.defaultCharset());
  
          } catch (IOException e) {
              throw new RuntimeException();
          }
  
          return file;
      }
docs: name should be in the pattern: path/path/path/package.package.classname,
  for example <pre>/data/projects/my/src/main/java/org.my.project.MyStore</pre>
  would create class MyStore in package org.my.project in the path /data/projects/my/src/main/java