Class BshLocalDataBuilder

  • All Implemented Interfaces:
    LocalDataBuilder

    public class BshLocalDataBuilder
    extends java.lang.Object
    implements LocalDataBuilder
    Deduces the file name of a BeanShell scrip file from the source file name, and executes that script to create local data.

    The script must return a java.util.Map, which stores the variables that will be added to the local data.

    The following variables are accessible for the scripts:

    • Constructor Detail

      • BshLocalDataBuilder

        public BshLocalDataBuilder()
        Creates new instance.
    • Method Detail

      • build

        public java.util.Map build​(Engine eng,
                                   TemplateEnvironment env)
                            throws java.io.FileNotFoundException,
                                   DataModelBuildingException
        Description copied from interface: LocalDataBuilder
        Returns the variables that could be added to the local data.
        Specified by:
        build in interface LocalDataBuilder
        Returns:
        the variables to add to the local data. Can be null. The returned map will not be modified (although technically, badly behaved 3rd party code can modify the values soted in the map...).
        Throws:
        java.io.FileNotFoundException
        DataModelBuildingException
      • getEncoding

        public java.lang.String getEncoding()
      • setEncoding

        public void setEncoding​(java.lang.String encoding)
        Sets the encoding of the script files. If it is null then the value of the sourceEncoding setting will be used.
      • getEnding

        public java.lang.String getEnding()
      • setEnding

        public void setEnding​(java.lang.String ending)
        Sets the string appended at the end of the source file name. Can't be 0 length string. It defaults to ".bsh".
      • getIgnoreMissing

        public boolean getIgnoreMissing()
        Set if it will be ignored no script file found for the source file, rather than throwing an exception. Defaults to false.
      • setIgnoreMissing

        public void setIgnoreMissing​(boolean ignoreMissing)
      • getRemoveExtension

        public boolean getRemoveExtension()
      • setRemoveExtension

        public void setRemoveExtension​(boolean removeExtension)
        Sets if the extension from the source file name should be removed before appending the ending. The extension is the part after the last dot of the file name. The dot itself is also removed. Defaults to false.