Class CodeGenFiler

java.lang.Object
io.helidon.pico.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
    • deferredMoves

      public Map<Path,Path> deferredMoves()
      This map represents any move operations that were not capable at the time of code generation, that must be deferred until after the annotation processor has completed its round.
      Returns:
      map of deferred moves from source to target path locations
    • codegenMetaInfServices

      public void codegenMetaInfServices(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, Optional<Function<InputStream,String>> optFnUpdater)
      Code generates a resource, providing the ability to update if the resource already exists.
      Parameters:
      outPath - the path to output the resource to
      body - the resource body
      optFnUpdater - the optional updater of the 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