Show in Frame No Frame
Up Previous Next Title Page Index Contents Search

9.3 API Types Reference

The API is implemented as a set of MetaEdit+ methods, along with their typed parameter values and return values. In addition to standard types like integers and strings, the API uses four MetaEdit+ specific types: MEOop, MEAny, METype and MENull. All except MENull can also be members of arrays, e.g. MEOopArray: in a client, the language determines the representation of arrays, but normally it is simply a native array of MEOops, rather than a specific MEOopArray class.

MEOop

*areaID: int
*objectID: int
A handle to a GOPPRR conceptual or representational instance in the repository. A concept can be a Graph, Object, Relationship, Role, Port, Property or Binding. A representation can be a Diagram, Matrix or Table, or an object or binding representation. Generally, an MEOop is either built based on output from an oid command in a generator (as in the Watch example), or then obtained as an answer to a previous API command.

MEAny

*meType: string
*meValue: string
MEAny is used to handle polymorphism, where a parameter can be of several different types. E.g. the value of a Property might be a String, Text, Integer, OrderedCollection, MEOop for an object as a property value etc. The data type of the value is stored as a string in meType, and a string representation of the value is stored in meValue. Below each possible meType is listed along with the string representation for its meValue:
*For MEOop: 3_12345 (areaID, underscore, objectID) any.meType="MEOop"; any.meValue="3_12345";
*For String or Text: 'a string' (note the quotes; embedded quotes are doubled) any.meType="String"; any.meValue="'isn''t'";
*For Integer: 34 (note you must convert this string value to an integer) any.meType="Integer"; any.meValue="34";
*For Number: meValue string is a decimal float representation with ‘.’ as decimal point and ‘e’ as mantissa separator (no spaces) any.meType="Number"; any.meValue="2.998e8";
*For Boolean: meValue string is true or false or ‘1’ or ‘0’ (as strings) any.meType="Boolean"; any.meValue="true";
*For MENull: meValue string is empty (can also accept any content, e.g. nil) any.meType="MENull"; any.meValue="";
*For Point: 10,20 (x co-ordinate, y co-ordinate: note no space after the comma) any.meType="Point"; any.meValue="10,20";
*For OrderedCollection: space-separated representations of MEOop, String, Integer, Number or Point any.meType="OrderedCollection"; any.meValue="3_123 3_125 3_127"; any.meValue="'one' 'two' 'three'"; any.meValue="1 2 3";
*For TimestampUTC: meValue string is yyyy-mm-ddThh:mm:ss.fffZ with time in UTC (date must be supplied in full, but time units can be left off from the end, and time zone is optional and ignored, being always UTC) any.meType="TimestampUTC"; any.meValue="2016-12-31T23:59";

METype

*name: string
Represents a type from the metamodel. Can be either the internal name (e.g. OPRRObj_Use_Case_sysadmin_12387234) or the user-visible name (e.g. Use Case). MetaEdit+ will return METypes with the internal name; the user-visible name can be obtained from an METype with the typeName method.
When MetaEdit+ receives an METype, it will look up the name first as an internal name, and if that fails, as a user-visible name across all Graph, Object, Relationship, Role, Port and Property types (in that order, depth first). Since the internal name of these metatypes is the same as the user-visible name (except for OPRRObj for Object), an METype with name="Role" will find the Role metatype, not a user-created object type called “Role”. To look up an object type called “Role”, “Port” etc. you may use its internal name, or the subTypeNamed() method:
METype objMetaType=new METype(); objMetaType.name="OPRRObj";
METype myType=api.subTypeNamed(objMetaType, "Role");

MENull

Represents the nil value, e.g. the return value from a command that returns nothing, or (within an MEAny) the value of a property whose data type is an object type, but which has no object assigned yet as a value.

Show in Frame No Frame
Up Previous Next Title Page Index Contents Search