Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
research:software:reflex:documentation:metaobject_definitions [2007/07/30 18:32] – created adminresearch:software:reflex:documentation:metaobject_definitions [2007/08/24 19:09] (current) rtoledo
Line 1: Line 1:
 +====== Metaobject Definitions ======
  
 +Metaobject definitions are a standard way to describe how Reflex will obtain a reference to a behavioral metaobject at runtime. 
 +
 +
 +The base (abstract) class for all metaobject definitions is [[http://reflex.dcc.uchile.cl/svn/base/trunk/src/reflex/api/link/MODefinition.java|MODefinition]], that is declared as follows:
 +
 +<code java>
 +public abstract class MODefinition{
 +        public abstract String getCode(BLink aBLink, Operation aOperation);
 +}
 +</code>
 +
 +As you can see, it defines just one method that should return the code to obtain a behavioral metaobject reference. As implemeting this method is not a trivial task, Reflex provides four subclasses that meet almost any requirement:
 +  * [[http://reflex.dcc.uchile.cl/svn/base/trunk/src/reflex/api/link/MODefinition.java|SharedMO]], a pre-existent (already instantiated) object will be used, for example: ''System.out'' or an object obtained from a framework.
 +<code java>
 +MODefinition theMODef = new MODefinition.SharedMO(<object reference>);
 +</code>
 +  * [[http://reflex.dcc.uchile.cl/svn/base/trunk/src/src/reflex/api/link/MODefinition.java|SharedFactory]], a pre-existent factory of metaobjects will be used. This factory will be asked for every metaobject that is about to be used and that has not been initialized yet.
 +<code java>
 +MODefinition theMODef = new MODefinition.SharedFactory(<factory ref>, CallDescriptor);
 +</code>
 +(The second parameter is a call descriptor object that are reviewed in detaill in this [[call_descriptors_parameters|section]]).
 +  * [[http://reflex.dcc.uchile.cl/svn/base/trunk/src/src/reflex/api/link/MODefinition.java|MOClass]], a new object will be created, based on the description given to the MOClass object:
 +<code java>
 +MODefinition theMODef = new MODefinition.MOClass(<class name>, Parameter...);
 +</code>
 +(The second parameter is a parameter object that is reviewed in detaill in this [[call_descriptors_parameters|section]]).
 +  * [[http://reflex.dcc.uchile.cl/svn/base/trunk/src/src/reflex/api/link/MODefinition.java|FactoryClass]], a new factory of metaobjects will be used. This factory will be asked for every metaobject that is about to be used and that has not been initilized yet.
 +<code java>
 +MODefinition theMODef = new MODefinition.FactoryClass(<class name>, CallDescriptor);
 +</code>
 +(The second parameter is a call descriptor object that are reviewed in detaill in this [[call_descriptors_parameters|section]]).