Class LayeredEngine.Builder

java.lang.Object
ch.grengine.engine.LayeredEngine.Builder
Enclosing class:
LayeredEngine

public static class LayeredEngine.Builder extends Object
Builder for instances of LayeredEngine.
Since:
1.0
Author:
Alain Stalder, Made in Switzerland.
  • Constructor Details

    • Builder

      public Builder()
      constructor.
      Since:
      1.0
  • Method Details

    • setParent

      public LayeredEngine.Builder setParent(ClassLoader parent)
      sets the parent class loader, default is the context class loader of the current thread.
      Parameters:
      parent - parent class loader
      Returns:
      this, for chaining calls
      Throws:
      IllegalStateException - if the builder had already been used to build an instance
      Since:
      1.0
    • setLoadMode

      public LayeredEngine.Builder setLoadMode(LoadMode loadMode)
      sets the load mode for the (static) code layers, default is "current first".
      Parameters:
      loadMode - load mode for the (static) code layers
      Returns:
      this, for chaining calls
      Throws:
      IllegalStateException - if the builder had already been used to build an instance
      Since:
      1.0
    • setWithTopCodeCache

      public LayeredEngine.Builder setWithTopCodeCache(boolean isWithTopCodeCache)
      sets whether to use the a top code cache or not, default is true.

      Note that the default is the opposite in the LayeredClassLoader.

      Parameters:
      isWithTopCodeCache - whether to use the a top code cache or not
      Returns:
      this, for chaining calls
      Throws:
      IllegalStateException - if the builder had already been used to build an instance
      Since:
      1.0
    • setTopCodeCacheFactory

      public LayeredEngine.Builder setTopCodeCacheFactory(TopCodeCacheFactory topCodeCacheFactory)
      sets the top code cache factory, default is a new instance of DefaultTopCodeCacheFactory with default settings.
      Parameters:
      topCodeCacheFactory - top code cache factory
      Returns:
      this, for chaining calls
      Throws:
      IllegalStateException - if the builder had already been used to build an instance
      Since:
      1.0
    • setTopLoadMode

      public LayeredEngine.Builder setTopLoadMode(LoadMode topLoadMode)
      sets the load mode for the top code cache, default is "parent first".
      Parameters:
      topLoadMode - load mode for the top code cache
      Returns:
      this, for chaining calls
      Throws:
      IllegalStateException - if the builder had already been used to build an instance
      Since:
      1.0
    • setClassReleaser

      public LayeredEngine.Builder setClassReleaser(ClassReleaser classReleaser)
      sets the class releaser, default is the DefaultClassReleaser singleton instance.
      Parameters:
      classReleaser - class releaser
      Returns:
      this, for chaining calls
      Since:
      1.1
    • setAllowSameClassNamesInMultipleCodeLayers

      public LayeredEngine.Builder setAllowSameClassNamesInMultipleCodeLayers(boolean allowSameClassNamesInMultipleCodeLayers)
      sets whether to allow the same class names in multiple code layers, default is true.
      Parameters:
      allowSameClassNamesInMultipleCodeLayers - whether to allow the same class names in multiple code layers
      Returns:
      this, for chaining calls
      Throws:
      IllegalStateException - if the builder had already been used to build an instance
      Since:
      1.0
    • setAllowSameClassNamesInParentAndCodeLayers

      public LayeredEngine.Builder setAllowSameClassNamesInParentAndCodeLayers(boolean allowSameClassNamesInParentAndCodeLayers)
      sets whether to allow the same class names in code layers and parent class loader, default is true.
      Parameters:
      allowSameClassNamesInParentAndCodeLayers - whether to allow the same class names in code layers and parent class loader
      Returns:
      this, for chaining calls
      Throws:
      IllegalStateException - if the builder had already been used to build an instance
      Since:
      1.0
    • getParent

      public ClassLoader getParent()
      gets the parent class loader.
      Returns:
      parent class loader
      Since:
      1.0
    • getLoadMode

      public LoadMode getLoadMode()
      gets the load mode for the (static) code layers.
      Returns:
      load mode for the (static) code layers
      Since:
      1.0
    • isWithTopCodeCache

      public boolean isWithTopCodeCache()
      gets whether to use the a top code cache or not.
      Returns:
      whether to use the a top code cache or not
      Since:
      1.0
    • getTopLoadMode

      public LoadMode getTopLoadMode()
      gets the load mode for the top code cache.
      Returns:
      load mode for the top code cache
      Since:
      1.0
    • getClassReleaser

      public ClassReleaser getClassReleaser()
      gets the class releaser.
      Returns:
      class releaser
      Since:
      1.1
    • getTopCodeCacheFactory

      public TopCodeCacheFactory getTopCodeCacheFactory()
      gets the top code cache factory.
      Returns:
      top code cache factory
      Since:
      1.0
    • isAllowSameClassNamesInMultipleCodeLayers

      public boolean isAllowSameClassNamesInMultipleCodeLayers()
      gets whether to allow the same class names in multiple code layers.
      Returns:
      whether to allow the same class names in multiple code layers
      Since:
      1.0
    • isAllowSameClassNamesInParentAndCodeLayers

      public boolean isAllowSameClassNamesInParentAndCodeLayers()
      gets whether to allow the same class names in code layers and parent class loader.
      Returns:
      whether to allow the same class names in code layers and parent class loader
      Since:
      1.0
    • build

      public LayeredEngine build()
      builds a new instance of LayeredEngine.
      Returns:
      new instance
      Since:
      1.0