All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.codetrans.Lang Maven / Gradle / Ivy

There is a newer version: 4.1.0.Beta1
Show newest version
package io.vertx.codetrans;

import io.vertx.codegen.Case;

import java.io.File;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author Julien Viet
 */
public interface Lang {

  String id();

  Script loadScript(ClassLoader loader, String path, String method) throws Exception;

  default File createSourceFile(File root, List className, String methodName) {
    Stream.Builder builder = Stream.builder();
    className.forEach(builder::add);
    if (methodName != null) {
      builder.add((methodName));
    }
    String t = builder
      .build()
      .map(s -> Case.SNAKE.format(Case.CAMEL.parse(s)).replace('.', File.separatorChar))
      .collect(Collectors.joining(File.separator));
    return new File(root, t + "." + getExtension());
  }

  String getExtension();

  CodeBuilder codeBuilder();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy