Package net.officefloor.gef.bridge
Class ClassLoaderEnvironmentBridge
- java.lang.Object
-
- net.officefloor.gef.bridge.ClassLoaderEnvironmentBridge
-
- All Implemented Interfaces:
EnvironmentBridge
public class ClassLoaderEnvironmentBridge extends java.lang.Object implements EnvironmentBridge
ClassLoader
EnvironmentBridge
.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.officefloor.gef.bridge.EnvironmentBridge
EnvironmentBridge.PreferenceEvent, EnvironmentBridge.PreferenceListener, EnvironmentBridge.SelectionHandler
-
-
Constructor Summary
Constructors Constructor Description ClassLoaderEnvironmentBridge()
Instantiate with defaultClassLoader
.ClassLoaderEnvironmentBridge(java.lang.ClassLoader classLoader)
Instantiate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPreferenceListener(EnvironmentBridge.PreferenceListener listener)
java.lang.ClassLoader
getClassLoader()
Obtains theClassLoader
.OfficeFloorCompiler
getOfficeFloorCompiler()
Obtains theOfficeFloorCompiler
.java.lang.String
getPreference(java.lang.String preferenceId)
Obtains the preference.boolean
isClassOnClassPath(java.lang.String className)
Indicates ifClass
on theClass
path.boolean
isResourceOnClassPath(java.lang.String resourcePath)
Indicates if the resource is on theClass
path.boolean
isSuperType(java.lang.String className, java.lang.String superType)
Indicates if super type.<S> java.lang.Class<? extends S>
loadClass(java.lang.String className, java.lang.Class<S> superType)
Loads theClass
.void
resetPreference(java.lang.String preferenceId)
Resets the preference to default value.void
selectClass(java.lang.String searchText, java.lang.String superType, EnvironmentBridge.SelectionHandler handler)
Selects aClass
.void
selectClassPathResource(java.lang.String searchText, EnvironmentBridge.SelectionHandler handler)
Selects a resource from theClass
path.void
setPreference(java.lang.String preferenceId, java.lang.String value)
Specifies the preference value.
-
-
-
Method Detail
-
isClassOnClassPath
public boolean isClassOnClassPath(java.lang.String className)
Description copied from interface:EnvironmentBridge
Indicates ifClass
on theClass
path.- Specified by:
isClassOnClassPath
in interfaceEnvironmentBridge
- Parameters:
className
- Name of theClass
.- Returns:
true
ifClass
on theClass
path.
-
isSuperType
public boolean isSuperType(java.lang.String className, java.lang.String superType)
Description copied from interface:EnvironmentBridge
Indicates if super type.- Specified by:
isSuperType
in interfaceEnvironmentBridge
- Parameters:
className
- Name ofClass
.superType
- Super typeClass
.- Returns:
true
if super typeClass
.
-
selectClass
public void selectClass(java.lang.String searchText, java.lang.String superType, EnvironmentBridge.SelectionHandler handler)
Description copied from interface:EnvironmentBridge
Selects aClass
.- Specified by:
selectClass
in interfaceEnvironmentBridge
- Parameters:
searchText
- Search text to find theClass
.superType
- Super type of theClass
.handler
-EnvironmentBridge.SelectionHandler
.
-
loadClass
public <S> java.lang.Class<? extends S> loadClass(java.lang.String className, java.lang.Class<S> superType) throws java.lang.Exception
Description copied from interface:EnvironmentBridge
Loads theClass
.- Specified by:
loadClass
in interfaceEnvironmentBridge
- Type Parameters:
S
- Super type.- Parameters:
className
- Name ofClass
.superType
- Super type required ofClass
.- Returns:
Class
.- Throws:
java.lang.Exception
- If fails to load theClass
.
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
Description copied from interface:EnvironmentBridge
Obtains theClassLoader
.- Specified by:
getClassLoader
in interfaceEnvironmentBridge
- Returns:
ClassLoader
.
-
getOfficeFloorCompiler
public OfficeFloorCompiler getOfficeFloorCompiler()
Description copied from interface:EnvironmentBridge
Obtains theOfficeFloorCompiler
.- Specified by:
getOfficeFloorCompiler
in interfaceEnvironmentBridge
- Returns:
OfficeFloorCompiler
.
-
isResourceOnClassPath
public boolean isResourceOnClassPath(java.lang.String resourcePath)
Description copied from interface:EnvironmentBridge
Indicates if the resource is on theClass
path.- Specified by:
isResourceOnClassPath
in interfaceEnvironmentBridge
- Parameters:
resourcePath
- Resource path.- Returns:
true
if the resource is on theClass
path.
-
selectClassPathResource
public void selectClassPathResource(java.lang.String searchText, EnvironmentBridge.SelectionHandler handler)
Description copied from interface:EnvironmentBridge
Selects a resource from theClass
path.- Specified by:
selectClassPathResource
in interfaceEnvironmentBridge
- Parameters:
searchText
- Search text to find theClass
path resource.handler
-EnvironmentBridge.SelectionHandler
.
-
getPreference
public java.lang.String getPreference(java.lang.String preferenceId)
Description copied from interface:EnvironmentBridge
Obtains the preference.- Specified by:
getPreference
in interfaceEnvironmentBridge
- Parameters:
preferenceId
- Preference identifier.- Returns:
- Preference value or
null
if no configured.
-
setPreference
public void setPreference(java.lang.String preferenceId, java.lang.String value)
Description copied from interface:EnvironmentBridge
Specifies the preference value.- Specified by:
setPreference
in interfaceEnvironmentBridge
- Parameters:
preferenceId
- Preference identifier.value
- Value for the preference.
-
resetPreference
public void resetPreference(java.lang.String preferenceId)
Description copied from interface:EnvironmentBridge
Resets the preference to default value.- Specified by:
resetPreference
in interfaceEnvironmentBridge
- Parameters:
preferenceId
- Preference identifier.
-
addPreferenceListener
public void addPreferenceListener(EnvironmentBridge.PreferenceListener listener)
Description copied from interface:EnvironmentBridge
- Specified by:
addPreferenceListener
in interfaceEnvironmentBridge
- Parameters:
listener
-EnvironmentBridge.PreferenceListener
.
-
-