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 MODefinition, that is declared as follows:

public abstract class MODefinition{
        public abstract String getCode(BLink aBLink, Operation aOperation);
}

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:

  • SharedMO, a pre-existent (already instantiated) object will be used, for example: System.out or an object obtained from a framework.
MODefinition theMODef = new MODefinition.SharedMO(<object reference>);
  • 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.
MODefinition theMODef = new MODefinition.SharedFactory(<factory ref>, CallDescriptor);

(The second parameter is a call descriptor object that are reviewed in detaill in this section).

  • MOClass, a new object will be created, based on the description given to the MOClass object:
MODefinition theMODef = new MODefinition.MOClass(<class name>, Parameter...);

(The second parameter is a parameter object that is reviewed in detaill in this section).

  • 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.
MODefinition theMODef = new MODefinition.FactoryClass(<class name>, CallDescriptor);

(The second parameter is a call descriptor object that are reviewed in detaill in this section).