Class CodeGenFiler

java.lang.Object
io.helidon.inject.tools.CodeGenFiler

public class CodeGenFiler extends Object
This class is used to generate the source and resources originating from either annotation processing or maven-plugin invocation. It also provides a circuit breaker in case the filer should be disabled from actually writing out source and resources, and instead will use the filer's messager to report what it would have performed (applicable for apt cases).
  • Method Details

    • create

      public static CodeGenFiler create(AbstractFilerMessager filer)
      Creates a new code gen filer.
      Parameters:
      filer - the physical filer
      Returns:
      a newly created code gen filer
    • scratchClassOutputPath

      public static Path scratchClassOutputPath(Path targetOutputPath)
      Returns the path to the target scratch directory for Injection.
      Parameters:
      targetOutputPath - the target class output path
      Returns:
      the target scratch path
    • targetClassOutputPath

      public static Path targetClassOutputPath(Filer filer)
      Returns the target class output directory.
      Parameters:
      filer - the filer
      Returns:
      the path to the target class output directory
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • codegenMetaInfServices

      public void codegenMetaInfServices(io.helidon.inject.tools.CodeGenPaths paths, Map<String,List<String>> metaInfServices)
      Generate the meta-inf services given the provided map.
      Parameters:
      paths - paths to where code should be written
      metaInfServices - the meta-inf services mapping
    • codegenResourceFilerOut

      public Optional<Path> codegenResourceFilerOut(String outPath, String body)
      Code generates a resource.
      Parameters:
      outPath - the path to output the resource to
      body - the resource body
      Returns:
      file path coordinates corresponding to the resource in question, or empty if not generated
    • codegenJavaFilerOut

      public Optional<Path> codegenJavaFilerOut(TypeName typeName, String body)
      Code generate a java source file.
      Parameters:
      typeName - the source type name
      body - the source body
      Returns:
      the new file path coordinates or empty if nothing was written