Class PdePreprocessor.PdePreprocessorBuilder

java.lang.Object
processing.mode.java.preproc.PdePreprocessor.PdePreprocessorBuilder
Enclosing class:
PdePreprocessor

public static class PdePreprocessor.PdePreprocessorBuilder extends Object
Builder to help instantiate a PdePreprocessor. The PdePreprocessor includes a number of parameters, including some behavioral parameters that change how the parse tree is processed. This builder helps instantiate this object by providing reasonable defaults for most values but allowing client to (especially modes) to override those defaults.
  • Field Details

    • BASE_CORE_IMPORTS

      public static final String[] BASE_CORE_IMPORTS
      The imports required for the Java processing mode.

      The set of imports required by processing itself (in java mode) that are made public so that client code (like in modes) can modify and re-use this list.

    • BASE_DEFAULT_IMPORTS

      public static final String[] BASE_DEFAULT_IMPORTS
      The imports provided as a convenience for the user.

      The imports that are not strictly required by processing sketches but that are included on behalf of the user that are made public so that client code (like in modes) can modify and re-use this list.

  • Method Details

    • setTabSize

      public PdePreprocessor.PdePreprocessorBuilder setTabSize(int newTabSize)
      Set how large the tabs should be.
      Parameters:
      newTabSize - The number of spaces in a tab.
      Returns:
      This builder for method chaining.
    • setIsTesting

      public PdePreprocessor.PdePreprocessorBuilder setIsTesting(boolean newIsTesting)
      Indicate if this preprocessor is running within unittests.
      Parameters:
      newIsTesting - Flag that, if true, will configure the preprocessor to run safely within a unit testing environment.
      Returns:
      This builder for method chaining.
    • setParseTreeListenerFactory

      Specify how the parse tree listener should be built. The ANTLR parse tree listener is where the preprocessing edits are generated and some client code (like modes) may need to override some preprocessing edit behavior. Specifying this factory allows client code to replace the default PdeParseTreeListener used during preprocessing.
      Parameters:
      newFactory - The factory to use in building a parse tree listener.
      Returns:
      This builder for method chaining.
    • setDefaultImports

      public PdePreprocessor.PdePreprocessorBuilder setDefaultImports(List<String> newDefaultImports)
      Indicate which imports are provided on behalf of the user for convenience.
      Parameters:
      newDefaultImports - The new set of default imports.
      Returns:
      This builder for method chaining.
    • setCoreImports

      public PdePreprocessor.PdePreprocessorBuilder setCoreImports(List<String> newCoreImports)
      Indicate which imports are required by processing or the mode itself.
      Parameters:
      newCoreImports - The new set of core imports.
      Returns:
      This builder for method chaining.
    • setDestinationPackage

      public PdePreprocessor.PdePreprocessorBuilder setDestinationPackage(String newDestinationPackage)
      Specify to which package generated code should be assigned.
      Parameters:
      newDestinationPackage - The package to which output code should be assigned.
      Returns:
      This builder for method chaining.
    • build

      public PdePreprocessor build()
      Build the preprocessor.