Package org.zeroturnaround.javarebel
Interface Configuration
public interface Configuration
This class manages JRebel configuration.
To manage the classes that will be instrumented use the filter methods
addExcludeManagedFilter(ClassFilter) and addIncludeManagedFilter(ClassFilter).
If you need to override the default behavior (e.g. you don't need class files to be managed)
use clearManagedFilters() to disable the default filters. If you want to filter
classes by packages you can use PackageClassFilter.
The filter methods work as follows:
- If at least one exclude filter matches a class it will not be instrumented.
- If none of the exclude filters match a class and at least one of the include filters matches a class it will be instrumented.
For example, if you want all classes in a particular JAR to be instrumented you can use a following filter:
ConfigurationFactory.getInstance()
.addIncludeManagedFilter(new ClassFilter() {
public boolean matches(ClassLoader cl, String className,
Resource classResource) {
return classResource.toURL().getPath().contains("mylibrary.jar");
}
});
- Since:
- 1.2
- Author:
- Jevgeni Kabanov (ekabanov@zeroturnaround.com)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds an exclude filter for the entire class loader (including plug-ins).voidaddExcludeFilter(String classLoaderClassName) Adds an exclude filter for the entire class loader (including plug-ins).voidaddExcludeFilter(ClassLoaderFilter classLoaderFilter) Adds an exclude filter for entire class loaders (including plug-ins).voidAdds an exclude filter for managed classes.voidaddExcludeManagedFilter(ClassFilter classFilter) Adds an exclude filter for managed classes.voidaddExcludeManagedFilter(ClassIdentityFilter classFilter) Adds an exclude filter for managed classes.voidAdds an include filter for managed classes.voidaddIncludeManagedFilter(ClassFilter classFilter) Adds an include filter for managed classes.voidaddIncludeManagedFilter(ClassIdentityFilter classFilter) Adds an include filter for managed classes.voidClears all currently used filters including the default ones.booleangetBoolean(String key) Gets the boolean value of a system property indicated by the specified key.booleangetBoolean(String key, boolean defaultValue) Gets the boolean value of a system property indicated by the specified key.intAdvisable time between checks for updates in framework specific configuration files.getClassResource(ClassLoader cl, String classname) Returns a JRebel Resource exactly as JRebel will load it.getProperty(String key) Gets the system property indicated by the specified key.booleanReturns whether the filters will deny the given class loader.booleanisManagedClass(ClassLoader cl, String classname, Resource cr) Returns whether the filters will allow the given class to be managed.booleanisManagedClassExcluded(ClassLoader cl, String classname) Returns whether the filters will deny the given class to be managed.booleanChecks whether the given plugin is enabled.
-
Method Details
-
getProperty
Gets the system property indicated by the specified key. If no system property is found with that key a property from file namedjrebel.propertiesis returned.- Parameters:
key- the name of the system property.- Returns:
- the string value of the property,
or
nullif there is no property with that key.
-
getBoolean
Gets the boolean value of a system property indicated by the specified key. If no system property is found with that key a property from file namedjrebel.propertiesis returned.- Parameters:
key- the name of the system property.- Returns:
- the boolean value of the property,
falseif there is no property with that key.
-
getBoolean
Gets the boolean value of a system property indicated by the specified key. If no system property is found with that key a property from file namedjrebel.propertiesis returned.- Parameters:
key- the name of the system property.defaultValue- value to return if there is no property with that key- Returns:
- the boolean value of the property or
defaultValue.
-
getCheckInterval
int getCheckInterval()Advisable time between checks for updates in framework specific configuration files.- Returns:
- time in ms.
-
getProductName
String getProductName()- Returns:
- product name (JRebel).
-
isPluginEnabled
Checks whether the given plugin is enabled.- Parameters:
id- plugin id (seePlugin.getId()).- Returns:
trueif the given plugin is enabled.
-
clearManagedFilters
void clearManagedFilters()Clears all currently used filters including the default ones. Use it if you need to override the default behavior (e.g. you don't need class files to be managed). -
addExcludeFilter
Adds an exclude filter for the entire class loader (including plug-ins). -
addExcludeFilter
Adds an exclude filter for the entire class loader (including plug-ins). -
addExcludeFilter
Adds an exclude filter for entire class loaders (including plug-ins). -
isClassLoaderExcluded
Returns whether the filters will deny the given class loader. -
addIncludeManagedFilter
Adds an include filter for managed classes. -
addExcludeManagedFilter
Adds an exclude filter for managed classes. -
addIncludeManagedFilter
Adds an include filter for managed classes. -
addExcludeManagedFilter
Adds an exclude filter for managed classes. -
addIncludeManagedFilter
Adds an include filter for managed classes. If none of the exclude filters match a class and at least one of the include filters matches a class it will be instrumented by JRebel. -
addExcludeManagedFilter
Adds an exclude filter for managed classes. If at least one exclude filter matches a class it will not be instrumented by JRebel. -
isManagedClass
Returns whether the filters will allow the given class to be managed. This involves bothClassFilterandClassIdentityFilterrules. -
isManagedClassExcluded
Returns whether the filters will deny the given class to be managed. This involves onlyClassIdentityFilterrules. -
getClassResource
Returns a JRebel Resource exactly as JRebel will load it. E.g. if the resource is in the monitored directory it will return that. Note that this already includes managed filtering, that is ifisManagedClass(ClassLoader, String, Resource)returns false then this method will return null.
-