Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| research:software:reflex:documentation:standard_mop [2007/08/20 17:35] – admin | research:software:reflex:documentation:standard_mop [2007/08/24 22:15] (current) – rtoledo | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Standar MOP ====== | ||
| + | **NOTE: The standard MOP is partially obsolete at present. We rather recommend using Call Descriptors.** | ||
| + | |||
| + | Reflex provides a standard metaobject protocol (Standard MOP) for all the standard operations (Message send, message reception, instantiation, | ||
| + | It is important to note that **all** the available information is reified. Because of this reason, we explicitly encourage you to use a custom MOP through call descriptors and parameters. | ||
| + | |||
| + | ===== Standard MOP API ===== | ||
| + | |||
| + | As we said before, the standard MOP defines the way to communicate with the metaobject for all the standard operations. Here we will review each one of these sub-protocols. | ||
| + | |||
| + | There is one interface-method pair for each control: the metaobject must implement the interface and the method. | ||
| + | |||
| + | The method takes as unique parameter a " | ||
| + | |||
| + | ==== Message send ==== | ||
| + | |||
| + | The three interfaces are: | ||
| + | <code java> | ||
| + | public interface BeforeMsgSend{ | ||
| + | public void beforeMsgSend(DMsgSend aDMsgSend); | ||
| + | } | ||
| + | |||
| + | public interface AfterMsgSend{ | ||
| + | public void beforeMsgSend(DMsgSend aDMsgSend); | ||
| + | } | ||
| + | |||
| + | public interface AroundMsgSend{ | ||
| + | public void beforeMsgSend( | ||
| + | DMsgSend aDMsgSend, IExecutionPointClosure aClosure | ||
| + | ); | ||
| + | } | ||
| + | </ | ||
| + | And the [[http:// | ||
| + | <code java> | ||
| + | public Method getMethod(){...} | ||
| + | </ | ||
| + | Returns the invoked method. | ||
| + | <code java> | ||
| + | public String getMethodName(){...} | ||
| + | </ | ||
| + | Returns the name of the invoked method. | ||
| + | <code java> | ||
| + | public Object[] getArguments(){...} | ||
| + | </ | ||
| + | Returns the arguments of the invocation. | ||
| + | <code java> | ||
| + | public Object getTargetObject(){...} | ||
| + | </ | ||
| + | Returns the object target of the invocation, or null if the called method is static. | ||
| + | <code java> | ||
| + | public Class getDeclaringClass(){...} | ||
| + | </ | ||
| + | Returns the class that declares this method. | ||
| + | |||
| + | ==== Message receive ==== | ||
| + | |||
| + | The three interfaces are: | ||
| + | <code java> | ||
| + | public interface BeforeMsgReceive{ | ||
| + | public void beforeMsgReceive(DMsgSend aDMsgReceive); | ||
| + | } | ||
| + | |||
| + | public interface AfterMsgReceive{ | ||
| + | public void beforeMsgReceive(DMsgSend aDMsgReceive); | ||
| + | } | ||
| + | |||
| + | public interface AroundMsgReceive{ | ||
| + | public void beforeMsgReceive( | ||
| + | DMsgSend aDMsgReceive, | ||
| + | ); | ||
| + | } | ||
| + | </ | ||
| + | And the [[http:// | ||
| + | <code java> | ||
| + | public Method getMethod(){...} | ||
| + | </ | ||
| + | Returns the invoked method. | ||
| + | <code java> | ||
| + | public Object[] getArguments(){...} | ||
| + | </ | ||
| + | Returns the arguments of the invocation. | ||
| + | |||
| + | ==== Instantiation ==== | ||
| + | |||
| + | The three interfaces are: | ||
| + | <code java> | ||
| + | public interface BeforeInstantiation{ | ||
| + | public void beforeInstantiation(DMsgSend aDInstantiation); | ||
| + | } | ||
| + | |||
| + | public interface AfterInstantiation{ | ||
| + | public void beforeInstantiation(DMsgSend aDInstantiation); | ||
| + | } | ||
| + | |||
| + | public interface AroundInstantiation{ | ||
| + | public void beforeInstantiation( | ||
| + | DMsgSend aDInstantiation, | ||
| + | ); | ||
| + | } | ||
| + | </ | ||
| + | And the [[http:// | ||
| + | <code java> | ||
| + | public String getReceiverClassname(){...} | ||
| + | </ | ||
| + | Returns the name of the class being instantiated. | ||
| + | <code java> | ||
| + | public Class getReceiverClass(){...} | ||
| + | </ | ||
| + | Returns the class being instantiated. | ||
| + | <code java> | ||
| + | public Object[] getArguments(){...} | ||
| + | </ | ||
| + | Returns the arguments of the instantiation. | ||
| + | |||
| + | ==== Creation ==== | ||
| + | |||
| + | The three interfaces are: | ||
| + | <code java> | ||
| + | public interface BeforeCreation{ | ||
| + | public void beforeCreation(DMsgSend aDCreation); | ||
| + | } | ||
| + | |||
| + | public interface AfterCreation{ | ||
| + | public void beforeCreation(DMsgSend aDCreation); | ||
| + | } | ||
| + | |||
| + | public interface AroundCreation{ | ||
| + | public void beforeCreation( | ||
| + | DMsgSend aDCreation, IExecutionPointClosure aClosure | ||
| + | ); | ||
| + | } | ||
| + | </ | ||
| + | And the [[http:// | ||
| + | <code java> | ||
| + | public Object[] getArguments(){...} | ||
| + | </ | ||
| + | Returns the arguments of the creation. | ||
| + | |||
| + | ==== Field Access ==== | ||
| + | |||
| + | The three interfaces are: | ||
| + | <code java> | ||
| + | public interface BeforeFieldAccess{ | ||
| + | public void beforeFieldAccess(DMsgSend aDFieldAccess); | ||
| + | } | ||
| + | |||
| + | public interface AfterFieldAccess{ | ||
| + | public void beforeFieldAccess(DMsgSend aDFieldAccess); | ||
| + | } | ||
| + | |||
| + | public interface AroundFieldAccess{ | ||
| + | public void beforeFieldAccess( | ||
| + | DMsgSend aDFieldAccess, | ||
| + | ); | ||
| + | } | ||
| + | </ | ||
| + | And the [[http:// | ||
| + | <code java> | ||
| + | public | ||
| + | </ | ||
| + | Returns the field being accessed. | ||
| + | <code java> | ||
| + | public String getFieldName(){...} | ||
| + | </ | ||
| + | Returns the name of the accessed field. | ||
| + | <code java> | ||
| + | public boolean isRead(){...} | ||
| + | </ | ||
| + | Returns the boolean indicating if it is a read or write access. | ||
| + | <code java> | ||
| + | public String getTypeName(){...} | ||
| + | </ | ||
| + | Returns the name of the target type. | ||
| + | <code java> | ||
| + | public Object getValue(){...} | ||
| + | </ | ||
| + | Returns the value being set if the operation is field access, null if it is not. | ||
| + | <code java> | ||
| + | public Object getTargetObject(){...} | ||
| + | </ | ||
| + | Returns the object that owns the field, null if the field is static. | ||
| + | <code java> | ||
| + | public Class getDeclaringClass(){...} | ||
| + | </ | ||
| + | Returns the class that declares the field. | ||
| + | |||
| + | ==== Cast ==== | ||
| + | |||
| + | The three interfaces are: | ||
| + | <code java> | ||
| + | public interface BeforeCast{ | ||
| + | public void beforeCast(DMsgSend aDCast); | ||
| + | } | ||
| + | |||
| + | public interface AfterCast{ | ||
| + | public void beforeCast(DMsgSend aDCast); | ||
| + | } | ||
| + | |||
| + | public interface AroundCast{ | ||
| + | public void beforeCast( | ||
| + | DMsgSend aDCast, IExecutionPointClosure aClosure | ||
| + | ); | ||
| + | } | ||
| + | </ | ||
| + | And the [[http:// | ||
| + | <code java> | ||
| + | public Class getTargetType(){...} | ||
| + | </ | ||
| + | Returns the target type of the cast. | ||
| + | <code java> | ||
| + | public Object getTargetObject(){...} | ||
| + | </ | ||
| + | Returns the target object of the cast. | ||
| + | |||
| + | ==== DynamicOperation ==== | ||
| + | |||
| + | All dynamic classes extend from a common superclass: [[http:// | ||
| + | |||
| + | Let us review the class: | ||
| + | <code java> | ||
| + | public abstract class DynamicOperation{ | ||
| + | |||
| + | public Object getContextObject(){...} | ||
| + | |||
| + | public Object getResult(){...} | ||
| + | |||
| + | public abstract Object perform(); | ||
| + | } | ||
| + | </ | ||
| + | The '' | ||
| + | |||
| + | The '' | ||
| + | |||
| + | And finally, the '' | ||

