Une image contenant texte, signe

Description générée automatiquement

JSON Classifiers

 

Overview

 

Classifiers such as classes, blocks and use cases are of type ModelElement along with the correct metaclass and (optionally) user defined metaclass, for example:

 

A close up of a text

Description automatically generated

Classifiers have:

·       Attributes (type = ‘Attribute’)

·       Interface items: event receptions / operations (type=’InterfaceItem’)

These are held in the nestedElements array.

For example:

A screen shot of a computer code

Description automatically generated

 

Attributes

Attributes are custom JSON objects (type=”Attribute”) and do not require a metaclass.

Attributes have a type which is indicated in various ways, see JSON Types

Attributes in port contracts may have directions (see JSON Ports)

Interface Items

Interface items are custom JSON objects (type=”InterfaceItem”). Since they can be either event receptions or operations, they do require the metaclass attribute which should be either “EventReception” or “Operation”.

 

Operations

Operations have (optionally) arguments, a body and a return type:

·       Arguments (type & metaclass = ‘Argument’) appear in nested elements and have a type (see Json Types) and (optionally) a direction (the default direction is In)

·       Bodies are specified using the body attribute (as a string you may need to escape some characters to avoid clashing with the JSON)

·       Return types are specified using a returnType attribute (see JSON Types).

A close up of words

Description automatically generated

            A screen shot of a computer code

Description automatically generated

 

Event Receptions

Event receptions are (optionally) typed by events. This is indicated with an event attribute that contains the full path to the desired event. If no event is specified, then the importer will simply ask Rhapsody to add an event reception by name. Rhapsody will then use the first event it finds with that name or create one in the same package if none exists.

A close up of a text

Description automatically generated