Package ch.grengine.engine
Class LayeredEngine.Builder
java.lang.Object
ch.grengine.engine.LayeredEngine.Builder
- Enclosing class:
- LayeredEngine
Builder for instances of
LayeredEngine.- Since:
- 1.0
- Author:
- Alain Stalder, Made in Switzerland.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()builds a new instance ofLayeredEngine.gets the class releaser.gets the load mode for the (static) code layers.gets the parent class loader.gets the top code cache factory.gets the load mode for the top code cache.booleangets whether to allow the same class names in multiple code layers.booleangets whether to allow the same class names in code layers and parent class loader.booleangets whether to use the a top code cache or not.setAllowSameClassNamesInMultipleCodeLayers(boolean allowSameClassNamesInMultipleCodeLayers) sets whether to allow the same class names in multiple code layers, default is true.setAllowSameClassNamesInParentAndCodeLayers(boolean allowSameClassNamesInParentAndCodeLayers) sets whether to allow the same class names in code layers and parent class loader, default is true.setClassReleaser(ClassReleaser classReleaser) sets the class releaser, default is theDefaultClassReleasersingleton instance.setLoadMode(LoadMode loadMode) sets the load mode for the (static) code layers, default is "current first".setParent(ClassLoader parent) sets the parent class loader, default is the context class loader of the current thread.setTopCodeCacheFactory(TopCodeCacheFactory topCodeCacheFactory) sets the top code cache factory, default is a new instance ofDefaultTopCodeCacheFactorywith default settings.setTopLoadMode(LoadMode topLoadMode) sets the load mode for the top code cache, default is "parent first".setWithTopCodeCache(boolean isWithTopCodeCache) sets whether to use the a top code cache or not, default is true.
-
Constructor Details
-
Builder
public Builder()constructor.- Since:
- 1.0
-
-
Method Details
-
setParent
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
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
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
sets the top code cache factory, default is a new instance ofDefaultTopCodeCacheFactorywith 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
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
sets the class releaser, default is theDefaultClassReleasersingleton 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
gets the parent class loader.- Returns:
- parent class loader
- Since:
- 1.0
-
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
gets the load mode for the top code cache.- Returns:
- load mode for the top code cache
- Since:
- 1.0
-
getClassReleaser
gets the class releaser.- Returns:
- class releaser
- Since:
- 1.1
-
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
builds a new instance ofLayeredEngine.- Returns:
- new instance
- Since:
- 1.0
-