Package ch.grengine.load
Class LayeredClassLoader.Builder
java.lang.Object
ch.grengine.load.LayeredClassLoader.Builder
- Enclosing class:
- LayeredClassLoader
Builder for instances of
LayeredClassLoader.- Since:
- 1.0
- Author:
- Alain Stalder, Made in Switzerland.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuilds a new instance ofLayeredClassLoaderbased on already compiled code layers.builds a new instance ofLayeredClassLoaderbased on sources to compile to code layers.gets the code layers.gets the load mode for the (static) code layers.gets the parent class loader.gets the sources layers.gets the top code cache.gets the top load mode.booleangets whether to use the top code cache or not.setCodeLayers(Code... codeLayers) sets the code layers, default is no layers.setCodeLayers(List<Code> codeLayers) sets the code layers, default is no layers.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.setSourcesLayers(Sources... sourcesLayers) sets the sources layers, default is no layers.setSourcesLayers(List<Sources> sourcesLayers) sets the sources layers, default is no layers.setTopLoadMode(LoadMode topLoadMode) sets the load mode for the top code cache, default is "parent first".setWithTopCodeCache(boolean isWithTopCodeCache, TopCodeCache topCodeCache) sets whether to use the top code cache or not, along with the top code cache (OK to pass null if setting to false), default is not to use a top code cache.
-
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
- 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
- Since:
- 1.0
-
setSourcesLayers
sets the sources layers, default is no layers.- Parameters:
sourcesLayers- sources layers- Returns:
- this, for chaining calls
- Since:
- 1.0
-
setSourcesLayers
sets the sources layers, default is no layers.- Parameters:
sourcesLayers- sources layers- Returns:
- this, for chaining calls
- Since:
- 1.0
-
setCodeLayers
sets the code layers, default is no layers.- Parameters:
codeLayers- code layers- Returns:
- this, for chaining calls
- Since:
- 1.0
-
setCodeLayers
sets the code layers, default is no layers.- Parameters:
codeLayers- code layers- Returns:
- this, for chaining calls
- Since:
- 1.0
-
setWithTopCodeCache
public LayeredClassLoader.Builder setWithTopCodeCache(boolean isWithTopCodeCache, TopCodeCache topCodeCache) sets whether to use the top code cache or not, along with the top code cache (OK to pass null if setting to false), default is not to use a top code cache.Note that the default is the opposite in the
LayeredEngine.- Parameters:
isWithTopCodeCache- whether to use the top code cache or nottopCodeCache- top code cache (OK to pass null if setting to false)- Returns:
- this, for chaining calls
- 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
- 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
-
getSourcesLayers
gets the sources layers.- Returns:
- sources layers
- Since:
- 1.0
-
getCodeLayers
gets the code layers.- Returns:
- code layers
- Since:
- 1.0
-
isWithTopCodeCache
public boolean isWithTopCodeCache()gets whether to use the top code cache or not.- Returns:
- whether to use the top code cache or not
- Since:
- 1.0
-
getTopCodeCache
gets the top code cache.- Returns:
- top code cache
- Since:
- 1.0
-
getTopLoadMode
gets the top load mode.- Returns:
- top load mode
- Since:
- 1.0
-
buildFromCodeLayers
builds a new instance ofLayeredClassLoaderbased on already compiled code layers.- Returns:
- new instance
- Since:
- 1.0
-
buildFromSourcesLayers
builds a new instance ofLayeredClassLoaderbased on sources to compile to code layers.- Returns:
- new instance
- Throws:
CompileException- if compiling the sources layers failed- Since:
- 1.0
-