Interface Environment
- All Superinterfaces:
 Attributes
A named runtime environment containing a 
ClassLoader and Attributes.- 
Nested Class Summary
Nested classes/interfaces inherited from interface Attributes
Attributes.Layer, Attributes.Lazy, Attributes.Mapped, Attributes.Synthetic, Attributes.Wrapper - 
Field Summary
FieldsFields inherited from interface Attributes
NULL - 
Method Summary
Modifier and TypeMethodDescriptionstatic Environmentcreate(String name, ClassLoader classLoader) Creates an environment with the given name and classloader.static EnvironmentGets the environment with the given name, creating it with the default classloader if necessary.static EnvironmentGets the environment with the given name.static Collection<Environment> getAll()Gets all existing environments.getName()static voidRemoves all the environments.default voidRun aRunnablein the environment, i.e. with currentThread.getContextClassLoader()set togetClassLoader().Methods inherited from interface Attributes
asAttributeMap, clearAttributes, equals, getAttribute, getAttributeNameSet, hashCode, removeAttribute, setAttribute 
- 
Field Details
- 
LOG
static final org.slf4j.Logger LOG 
 - 
 - 
Method Details
- 
getAll
 - 
removeAll
static void removeAll()Removes all the environments. - 
get
Gets the environment with the given name.- Parameters:
 name- the environment name- Returns:
 - the environment, or null if no environment with such name exists
 
 - 
ensure
Gets the environment with the given name, creating it with the default classloader if necessary.- Parameters:
 name- the environment nameclassToLoad- A class to either: use to create the environment with its classloader; or to check the environments can load the passed class.- Returns:
 - the environment
 - Throws:
 IllegalArgumentException- if an environment with the given name but a different classloader already existsIllegalStateException
 - 
create
Creates an environment with the given name and classloader.- Parameters:
 name- the environment nameclassLoader- the environment classloader- Returns:
 - the environment
 - Throws:
 IllegalStateException- if an environment with the given name already exists
 - 
getName
String getName()- Returns:
 - The case-insensitive name of the environment.
 
 - 
getClassLoader
ClassLoader getClassLoader()- Returns:
 - The 
ClassLoaderfor the environment or if none set, then theClassLoaderthat loaded the environment implementation. 
 - 
run
Run aRunnablein the environment, i.e. with currentThread.getContextClassLoader()set togetClassLoader().- Parameters:
 runnable- TheRunnableto run in the environment.
 
 -