public static class DirBasedSources.Builder extends Object
DirBasedSources.| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_LATENCY_MS
the default latency (5000ms = five seconds).
|
| Constructor and Description |
|---|
Builder(File dir)
constructor from script file directory.
|
| Modifier and Type | Method and Description |
|---|---|
DirBasedSources |
build()
builds a new instance of
DirBasedSources. |
CompilerFactory |
getCompilerFactory()
gets the compiler factory.
|
File |
getDir()
gets the script file directory.
|
DirMode |
getDirMode()
gets the dir mode.
|
long |
getLatencyMs()
gets the latency in milliseconds.
|
String |
getName()
gets the sources name.
|
Set<String> |
getScriptExtensions()
gets the script extensions.
|
SourceFactory |
getSourceFactory()
gets the source factory.
|
DirBasedSources.Builder |
setCompilerFactory(CompilerFactory compilerFactory)
sets the compiler factory for compiling sources, default
is a new instance of
DefaultGroovyCompilerFactory. |
DirBasedSources.Builder |
setDirMode(DirMode dirMode)
sets the dir mode, default is not to scan subdirectories.
|
DirBasedSources.Builder |
setLatencyMs(long latencyMs)
sets the latency in milliseconds for checking if script files
in the directory have changed, default is
DEFAULT_LATENCY_MS. |
DirBasedSources.Builder |
setName(String name)
sets the sources name, default is the canonical file path,
with fallback to the absolute file path.
|
DirBasedSources.Builder |
setScriptExtensions(Set<String> scriptExtensions)
sets the script extensions, default is only "groovy".
|
DirBasedSources.Builder |
setScriptExtensions(String... scriptExtensions)
sets the script extensions, default is only "groovy".
|
DirBasedSources.Builder |
setSourceFactory(SourceFactory sourceFactory)
sets the source factory for creating sources from files, default
is a new instance of
DefaultSourceFactory. |
public static final long DEFAULT_LATENCY_MS
public Builder(File dir)
The given file is immediately converted to the canonical file, with fallback to the absolute file.
dir - script file directoryNullPointerException - if the directory is nullpublic DirBasedSources.Builder setDirMode(DirMode dirMode)
dirMode - dir modeIllegalStateException - if the builder had already been used to build an instancepublic DirBasedSources.Builder setScriptExtensions(Set<String> scriptExtensions)
scriptExtensions - script extensionsIllegalStateException - if the builder had already been used to build an instancepublic DirBasedSources.Builder setScriptExtensions(String... scriptExtensions)
scriptExtensions - script extensionsIllegalStateException - if the builder had already been used to build an instancepublic DirBasedSources.Builder setName(String name)
name - sources nameIllegalStateException - if the builder had already been used to build an instancepublic DirBasedSources.Builder setCompilerFactory(CompilerFactory compilerFactory)
DefaultGroovyCompilerFactory.compilerFactory - compiler factoryIllegalStateException - if the builder had already been used to build an instancepublic DirBasedSources.Builder setSourceFactory(SourceFactory sourceFactory)
DefaultSourceFactory.sourceFactory - source factoryIllegalStateException - if the builder had already been used to build an instancepublic DirBasedSources.Builder setLatencyMs(long latencyMs)
DEFAULT_LATENCY_MS.latencyMs - latency in millisecondsIllegalStateException - if the builder had already been used to build an instancepublic File getDir()
public DirMode getDirMode()
public Set<String> getScriptExtensions()
public String getName()
public CompilerFactory getCompilerFactory()
public SourceFactory getSourceFactory()
public long getLatencyMs()
public DirBasedSources build()
DirBasedSources.