Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| research:software:reflex:documentation:behavioral_links_blinks [2007/08/20 17:32] – admin | research:software:reflex:documentation:behavioral_links_blinks [2007/08/20 17:33] (current) – admin | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Behavorial Links ====== | ||
| + | Behavioral links are the relation between the hookset and the metaobject definition. Links are the most important element of Reflex. They have a serie of attributed related to: the cardinality of the relation, the protocol of the communication among others. | ||
| + | |||
| + | |||
| + | In this section we will review all the attributes of a behavioral link: control, scope, activation, mintypes, updatable, declared type and initialization. | ||
| + | |||
| + | ===== Control ===== | ||
| + | |||
| + | Description: | ||
| + | The [[http:// | ||
| + | |||
| + | Possible values: | ||
| + | * '' | ||
| + | The control will be taken before the operation occurrence. | ||
| + | * '' | ||
| + | The control will be taken after the operation occurrence. | ||
| + | * '' | ||
| + | The control will be taken both before and after the operation occurrence. | ||
| + | * '' | ||
| + | The control will be taken instead of the operation occurrence (it will be taken before and it will return after the operation occurrence). | ||
| + | |||
| + | Default value: '' | ||
| + | |||
| + | Example code: | ||
| + | <code java> | ||
| + | BLink theBLink = ...; | ||
| + | theBLink.setControl(Control.BEFORE_AFTER); | ||
| + | </ | ||
| + | |||
| + | ===== Scope ===== | ||
| + | |||
| + | The [[http:// | ||
| + | |||
| + | Posible values: | ||
| + | * '' | ||
| + | Means that for each object in the application (which class is subject to this link) there will be one metaobject. | ||
| + | * '' | ||
| + | Means that for each class in the application (which is subject to this link) there will be one metaobject. | ||
| + | * '' | ||
| + | Means that for all classes in the application (which are subject to this link) there will be one metaobject. | ||
| + | |||
| + | Default value: '' | ||
| + | Example code: | ||
| + | <code java> | ||
| + | BLink theBLink = ...; | ||
| + | theBLink.setScope(Scope.CLASS); | ||
| + | </ | ||
| + | |||
| + | ===== Activation ===== | ||
| + | |||
| + | Description: | ||
| + | The [[http:// | ||
| + | * [[http:// | ||
| + | <code java> | ||
| + | public class Activation{ | ||
| + | public boolean isEnabled(){ ... } | ||
| + | |||
| + | public Active getActiveInstance(){ ... } | ||
| + | } | ||
| + | </ | ||
| + | * [[http:// | ||
| + | <code java> | ||
| + | public interface Active { | ||
| + | public boolean evaluate(Object aObject); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | At the end, and this must be be clear, the method that determines if a metaobject is active at a given time is '' | ||
| + | |||
| + | The '' | ||
| + | |||
| + | Util values have been defined for both classes, let us review them now. | ||
| + | |||
| + | Activation: | ||
| + | * '' | ||
| + | An activation that dicatates that the metaobject is always active (because its isEnabled method returns false, so the delegation never occur) and hence, it can not be changed at runtime. | ||
| + | * '' | ||
| + | An activation that dictates that the metaobject starts active, but this situation can be changed at runtime (because its isEnabled method returned true at generation time, and hence a delegation is occurring each time the hook is reached to determine if the metaobject is active). | ||
| + | * '' | ||
| + | An activation that dictates that the metaobject starts inactive, but this situation can be changed at runtime (because its isEnabled method returned true at generation time, and hence a delegation is occurring each time the hook is reached to determine if the metaobject is active). | ||
| + | |||
| + | Active: | ||
| + | * '' | ||
| + | Means that the metaobject is active. | ||
| + | * '' | ||
| + | Means that the metaobject is not active. | ||
| + | * '' | ||
| + | Means that to determine of the metaobject is active, a delegation should be done: | ||
| + | For hook belonging to a hookset in link L in a given object O instance of C will be active if and only if: | ||
| + | ** the activation condition of L evaluates to true, or | ||
| + | ** the activation condition of L is '' | ||
| + | ** the activation condition of L is '' | ||
| + | |||
| + | Default value: N/A depends on the specified '' | ||
| + | |||
| + | ===== Min Types ===== | ||
| + | |||
| + | The [[http:// | ||
| + | |||
| + | Default value: [] (empty list) | ||
| + | |||
| + | Example code: | ||
| + | <code java> | ||
| + | BLink theBLink = ...; | ||
| + | theBLink.getMinTypes().add(" | ||
| + | theBLink.getMinTypes().add(java.io.Externalizable.class); | ||
| + | </ | ||
| + | |||
| + | ===== Updatable ===== | ||
| + | |||
| + | The [[http:// | ||
| + | |||
| + | Posible values: | ||
| + | * '' | ||
| + | Means that the metaobject can be changed at runtime. | ||
| + | * '' | ||
| + | Means that the metaobject can not be changed at runtime. | ||
| + | |||
| + | Default value: '' | ||
| + | Example code: | ||
| + | <code java> | ||
| + | BLink theBLink = ...; | ||
| + | theBLink.setUpdatable(false); | ||
| + | </ | ||
| + | |||
| + | ===== Declared Type ===== | ||
| + | |||
| + | The [[http:// | ||
| + | When Reflex generates code, it assumes that the metaobject' | ||
| + | |||
| + | **Note:** this attribute is only taken into account for links with scope object or class (it is ignored if the link has global scope). | ||
| + | |||
| + | Default value: '' | ||
| + | |||
| + | Example code: | ||
| + | <code java> | ||
| + | BLink theBLink = ...; | ||
| + | theBLink.setDeclaredType(new DeclaredType(" | ||
| + | //or | ||
| + | theBLink.setDeclaredType(new DeclaredType(java.lang.Appendable.class); | ||
| + | </ | ||
| + | |||
| + | ===== Initilization ===== | ||
| + | |||
| + | The [[http:// | ||
| + | |||
| + | Posible values: | ||
| + | * '' | ||
| + | Means that the metaobject will be initialized eagerly at the end of each contructor if the scope is '' | ||
| + | * '' | ||
| + | Means that the metaobject will be initialized the first time it is required. This initialization is not synchronized, | ||
| + | * '' | ||
| + | Means that the metaobject will be initialized the first time it is required. This initialization is synchronized, | ||
| + | |||
| + | Default value: '' | ||
| + | |||
| + | Example code: | ||
| + | <code java> | ||
| + | BLink theBLink = ...; | ||
| + | theBLink.setInitialization(Initilization.EAGER); | ||
| + | </ | ||

