|
Table of Contents
Links providers & configuration classesThe Reflex kernel hooks classes according to the currently defined set of links. A link defines:
Link providersLink providers are entities that provide the Reflex kernel with links. One way to add links to the kernel is to specify a set of link providers as a command line option: reflex -lp provider1,...,providerN
The Configuration classes
public class MyConfig extends ReflexConfig { public void initReflex() { // Create a hookset Hookset theHookset = new PrimitiveHookset( FieldAccess.class, // We want to hook field accesses... AllCS.getInstance(), // ...on all classes... FieldWriteOS.getInstance()); // ...but only for field writes, excluding field reads // Create and dd the link to the config BLink theLink = addBLink( theHookset, new MODefinition.MOClass(MO_CLASSNAME)); // The metaobject will be obtained by instantiating a given class // Further configure the link: // There should be one system-wide instance of the metaobject... theLink.setScope(Scope.GLOBAL); // ...which should be called after the operation occurs theLink.setControl(Control.AFTER); // There is no activation condition, meaning the link is always active. theLink.setActivation(Activation.DISABLED); // Define the MOP: the metaobject should have its fieldWrite method called with no arguments. theLink.setMOCall(Control.AFTER, new CallDescriptor( MO_CLASSNAME, "fieldWrite", new Parameter[0])); } } In order to use this configuration class, simple call Reflex like this: reflex -lp class:MyConfig |