Class CompositeSources.Builder

java.lang.Object
ch.grengine.sources.CompositeSources.Builder
Enclosing class:
CompositeSources

public static class CompositeSources.Builder extends Object
Builder for instances of CompositeSources.
Since:
1.0
Author:
Alain Stalder, Made in Switzerland.
  • Field Details

    • DEFAULT_LATENCY_MS

      public static final long DEFAULT_LATENCY_MS
      the default latency (5000ms = five seconds).
      Since:
      1.0
      See Also:
  • Constructor Details

    • Builder

      public Builder(Collection<Sources> sourcesCollection)
      constructor from a collection of sources.
      Parameters:
      sourcesCollection - collection of sources
      Throws:
      NullPointerException - if the sources collection is null
      Since:
      1.0
  • Method Details

    • setName

      public CompositeSources.Builder setName(String name)
      sets the sources name, default is a generated random ID.
      Parameters:
      name - sources name
      Returns:
      this, for chaining calls
      Throws:
      IllegalStateException - if the builder had already been used to build an instance
      Since:
      1.0
    • setCompilerFactory

      public CompositeSources.Builder setCompilerFactory(CompilerFactory compilerFactory)
      sets the compiler factory for compiling sources, default is a new instance of DefaultGroovyCompilerFactory.
      Parameters:
      compilerFactory - compiler factory
      Returns:
      this, for chaining calls
      Throws:
      IllegalStateException - if the builder had already been used to build an instance
      Since:
      1.0
    • setLatencyMs

      public CompositeSources.Builder setLatencyMs(long latencyMs)
      sets the latency in milliseconds for checking if script files in the directory have changed, default is DEFAULT_LATENCY_MS.
      Parameters:
      latencyMs - latency in milliseconds
      Returns:
      this, for chaining calls
      Throws:
      IllegalStateException - if the builder had already been used to build an instance
      Since:
      1.0
    • getSourcesCollection

      public Collection<Sources> getSourcesCollection()
      gets the collection of sources.
      Returns:
      collection of sources
      Since:
      1.0
    • getName

      public String getName()
      gets the sources name.
      Returns:
      sources name
      Since:
      1.0
    • getCompilerFactory

      public CompilerFactory getCompilerFactory()
      gets the compiler factory.
      Returns:
      compiler factory
      Since:
      1.0
    • getLatencyMs

      public long getLatencyMs()
      gets the latency in milliseconds.
      Returns:
      latency in milliseconds
      Since:
      1.0
    • build

      public CompositeSources build()
      builds a new instance of CompositeSources.
      Returns:
      new instance
      Since:
      1.0