public class DefaultSourceFactory extends Object implements SourceFactory
SourceFactory
interface.
Generally used by default within Grengine, unless a different source factory has been explicitly indicated.
If the builder's URL content tracking is set, Source.getLastModified()
will be updated based on the URL content, within the latency period
and only if queried. For this purpose, a hash of the URL content is cached
internally for each URL source.
Modifier and Type | Class and Description |
---|---|
static class |
DefaultSourceFactory.Builder
Builder for
SourceFactory instances. |
Modifier | Constructor and Description |
---|---|
|
DefaultSourceFactory()
constructor from default builder (no URL tracking).
|
protected |
DefaultSourceFactory(DefaultSourceFactory.Builder builder)
constructor from builder.
|
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
clears the cache of URL content hashes.
|
Source |
fromFile(File file)
gets source from script file.
|
Source |
fromText(String text)
gets source from script text.
|
Source |
fromText(String text,
String desiredClassName)
gets source from script text and desired class name.
|
Source |
fromUrl(URL url)
gets source from script URL.
|
DefaultSourceFactory.Builder |
getBuilder()
gets the builder.
|
protected DefaultSourceFactory(DefaultSourceFactory.Builder builder)
builder
- builderpublic DefaultSourceFactory()
public Source fromText(String text)
SourceFactory
fromText
in interface SourceFactory
text
- script textpublic Source fromText(String text, String desiredClassName)
SourceFactory
fromText
in interface SourceFactory
text
- script textdesiredClassName
- desired class namepublic Source fromFile(File file)
SourceFactory
fromFile
in interface SourceFactory
file
- script filepublic Source fromUrl(URL url)
SourceFactory
fromUrl
in interface SourceFactory
url
- script URLpublic void clearCache()
public DefaultSourceFactory.Builder getBuilder()