Package com.scriptbasic.sourceproviders
Class AbstractSingleIncludeSourcePathSourceProvider
java.lang.Object
com.scriptbasic.sourceproviders.AbstractSourceProvider
com.scriptbasic.sourceproviders.AbstractSourcePathSourceProvider
com.scriptbasic.sourceproviders.AbstractSingleIncludeSourcePathSourceProvider
- All Implemented Interfaces:
SourcePathProvider,SourceProvider
- Direct Known Subclasses:
SingleIncludeSourcePathNonRelativeSourceProvider
public abstract class AbstractSingleIncludeSourcePathSourceProvider extends AbstractSourcePathSourceProvider
Abstract class to be extended by source provider implementations that include
a single file only once and use source path.
The implementations should not override the methods get() but should
implement the abstract methods getSource(). The method
getSource() is invoked only when it is ensured that the source was
not yet included.
- Author:
- Peter Verhas
-
Constructor Summary
Constructors Constructor Description AbstractSingleIncludeSourcePathSourceProvider() -
Method Summary
Modifier and Type Method Description SourceReaderget(java.lang.String sourceName)Get a reader to a source when there is no referencing source.SourceReaderget(java.lang.String sourceName, java.lang.String referencingSource)Get a reader to a source specifying the source that references this source.protected abstract java.lang.StringgetKeyName(java.lang.String sourceName)protected abstract java.lang.StringgetKeyName(java.lang.String sourceName, java.lang.String referencingSource)SingleIncludeCheckergetSingleInclude()protected abstract SourceReadergetSource(java.lang.String sourceName)protected abstract SourceReadergetSource(java.lang.String sourceName, java.lang.String referencingSource)voidsetSingleInclude(SingleIncludeChecker singleInclude)This setter can be called if the BasicSingleIncludeChecker as implementation is not appropriate.Methods inherited from class com.scriptbasic.sourceproviders.AbstractSourcePathSourceProvider
getSourcePath, setSourcePath
-
Constructor Details
-
AbstractSingleIncludeSourcePathSourceProvider
public AbstractSingleIncludeSourcePathSourceProvider()
-
-
Method Details
-
getSingleInclude
- Returns:
- the actual value of the single include checker
-
setSingleInclude
This setter can be called if the BasicSingleIncludeChecker as implementation is not appropriate. The default constructor will create one such object but later dependency injection can insert any object implementing the SingleIncludeChecker interface.This method allows configuration of these source providers in a DI container.
- Parameters:
singleInclude- to be injected by the container if there is any
-
get
Description copied from interface:SourceProviderGet a reader to a source when there is no referencing source. This is the main source.- Specified by:
getin interfaceSourceProvider- Specified by:
getin classAbstractSourceProvider- Parameters:
sourceName- the name of the source- Returns:
- reader reading the source file.
- Throws:
java.io.IOException- in case of exception
-
get
public final SourceReader get(java.lang.String sourceName, java.lang.String referencingSource) throws java.io.IOExceptionDescription copied from interface:SourceProviderGet a reader to a source specifying the source that references this source.- Specified by:
getin interfaceSourceProvider- Specified by:
getin classAbstractSourceProvider- Parameters:
sourceName- the name of the source to get the reader to.referencingSource- the name of the source that is referencing the source to read.- Returns:
- return value
- Throws:
java.io.IOException- in case of exception
-
getSource
- Throws:
java.io.IOException
-
getSource
protected abstract SourceReader getSource(java.lang.String sourceName, java.lang.String referencingSource) throws java.io.IOException- Throws:
java.io.IOException
-
getKeyName
protected abstract java.lang.String getKeyName(java.lang.String sourceName) -
getKeyName
protected abstract java.lang.String getKeyName(java.lang.String sourceName, java.lang.String referencingSource)
-