Class AdvancedBuilder

  • All Implemented Interfaces:
    ContainerBuilder

    public class AdvancedBuilder
    extends ContainerBuilderImpl
    Build a ScriptingContainer that is configured with a list of directories from which to load gems / add to the load path.
    • Constructor Detail

      • AdvancedBuilder

        public AdvancedBuilder()
    • Method Detail

      • withGemdirs

        public AdvancedBuilder withGemdirs​(java.lang.String... strings)
      • getGemdirs

        public java.util.List<java.lang.String> getGemdirs()
        Returns:
        the gemdirs
      • setGemdirs

        public void setGemdirs​(java.util.List<java.lang.String> gemdirs)
        Set the directories from which to try and load gems

        Under the covers this effectively does ScriptingContainer.addClassLoader() with a URLClassLoader built from the list of directories specified here (the actual directories might be affected by setAddSubdirs(Boolean)).

        Parameters:
        gemdirs - the list of gemdirs to set
      • getAddSubdirs

        public java.lang.Boolean getAddSubdirs()
      • setAddSubdirs

        public void setAddSubdirs​(java.lang.Boolean b)
        Set whether or not sub directories will be added.

        This is really just a convenience so that if you specify a gemdir of /home/vagrant/.rvm/gems/jruby-9.1.17.0/gems then it will add the contents of that directory in addition to the directory itself. This is to avoid you having to manually specify all the possible gems that are required (e.g. a list containing /home/vagrant/.rvm/gems/jruby-9.1.17.0/gems/jsonpath-0.9.3, /home/vagrant/.rvm/gems/jruby-9.1.17.0/gems/multi-json-1.13.1 etc.

        Parameters:
        b - true to additionally include the first level of sub-directories of any specified directory, default is true.
      • withAddSubdirs

        public AdvancedBuilder withAddSubdirs​(java.lang.Boolean b)
      • addSubdirs

        protected boolean addSubdirs()