Class AbstractSingleIncludeSourceProvider

java.lang.Object
com.scriptbasic.sourceproviders.AbstractSourceProvider
com.scriptbasic.sourceproviders.AbstractSingleIncludeSourceProvider
All Implemented Interfaces:
SourceProvider
Direct Known Subclasses:
SingleIncludeNonRelativeSourceProvider

public abstract class AbstractSingleIncludeSourceProvider
extends AbstractSourceProvider
An abstract class to be extended by the source provider implementations that do not want to include one source more than once.

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
    AbstractSingleIncludeSourceProvider()  
  • Method Summary

    Modifier and Type Method Description
    SourceReader get​(java.lang.String sourceName)
    Get a reader to a source when there is no referencing source.
    SourceReader get​(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.String getKeyName​(java.lang.String sourceName)  
    protected abstract java.lang.String getKeyName​(java.lang.String sourceName, java.lang.String referencingSource)  
    SingleIncludeChecker getSingleInclude()  
    protected abstract SourceReader getSource​(java.lang.String sourceName)  
    protected abstract SourceReader getSource​(java.lang.String sourceName, java.lang.String referencingSource)  
    void setSingleInclude​(SingleIncludeChecker singleInclude)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getSingleInclude

      public SingleIncludeChecker getSingleInclude()
    • setSingleInclude

      public void setSingleInclude​(SingleIncludeChecker singleInclude)
    • get

      public final SourceReader get​(java.lang.String sourceName) throws java.io.IOException
      Description copied from interface: SourceProvider
      Get a reader to a source when there is no referencing source. This is the main source.
      Specified by:
      get in interface SourceProvider
      Specified by:
      get in class AbstractSourceProvider
      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.IOException
      Description copied from interface: SourceProvider
      Get a reader to a source specifying the source that references this source.
      Specified by:
      get in interface SourceProvider
      Specified by:
      get in class AbstractSourceProvider
      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

      protected abstract SourceReader getSource​(java.lang.String sourceName) throws java.io.IOException
      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)