list of dots Digital Research Alliance of Canada logo  NSERC logo  University of Ottawa logo / UniversitĂ© d'Ottawa

User Manual    [Previous]   [Next]   

Types of Directives

Directives appear as the 'main' entries in an Umple file. The following are the main types:

  • Use statements include other Umple files to allow for modularization and reuse.

  • Entity declarations define the top level model or code elements including classes, interfaces, traits, associations, association classes, and enumerations. Other model or code elements, such as methods or attributes must be placed inside these entities. Note that the same entity can be declared more than once to add new internal contents. This is called using a mixin (one mixes together the contents of multiple declarations).

  • Aspects (code injections) tell Umple to inject certain code before, after or around certain methods of certain classes. These can be used to modify the behaviour of both custom and generated code.

  • Mixset directives. These are named blocks of Umple code that can be included (optionally) with a use statement. Several of them can have the same name. If there is no use statement for the mixset, that code is ignored. These can be used to build product lines and different software versions.

  • Namespace directives gather entities in logical groups. Within a namespace, entities must have different names. Namespaces affect code generation; for example they correspond to packages in Java.

  • Strictness Directives tell the compiler to issue extra warnings or errors in certain situations, or to turn certain errors into warnings, or to suppress certain warnings.

  • Generate directives tell Umple one or more generated outputs to create (see the grammar below for the list of languages and other outputs that can be generated). You can omit these entirely and specify them on the command line or using UmpleOnline. As a second argument on the generate directive, you can specify a path (directory) where the output should be put. You can also specify --override-all to ensure subsequent directives are ignored.

  • Tracer directives tell Umple which tracing tool to use in order to trace execution of the code.

Syntax


// Directives are the top-level items in an umple file. See manual page TypesofDirectives
// A directive is either used to configure the system or else is
// an actual entity of the system to be modelled or generated
directive- : [[checkForUnintendedBracket]]
    | [[glossary]]
    | [[generate]]
    | [[suboption]]
    | [[distribute]]
    | [[generate_path]]
    | [[filter]]
    | [[useStatement]]
    | [[namespace]]
    | [[requirement]]
    | [[reqImplementation]]
    | [[tracerDirective]]
    | [[entity]]
    | [[debug]]
    | [[strictness]]
    | [[toplevelExtracode]]
    | [[toplevelException]]

// The generate clause can be used to generate multiple outputs
// The --override is used to say that subsequent generate statements will be ignored
generate : generate [=language:Java
    |Nothing
    |Php
    |RTCpp
    |SimpleCpp
    |Ruby
    |Python
    |Cpp
    |Json
    |StructureDiagram
    |Yuml
    |Violet
    |Umlet
    |Simulate
    |TextUml
    |Scxml
    |GvStateDiagram
    |GvClassDiagram
    |GvFeatureDiagram
    |GvClassTraitDiagram
    |GvEntityRelationshipDiagram
    |Alloy
    |NuSMV
    |NuSMVOptimizer
    |Papyrus
    |Ecore
    |Xmi
    |Xtext
    |Sql
    |StateTables
    |EventSequence
    |Umple
    |UmpleSelf
    |USE
    |Test
    |SimpleMetrics
    |PlainRequirementsDoc
    |Uigu2
    |ExternalGrammar]
  ( [=suboptionIndicator:-s
    |--suboption] " [**suboption] "
  )* ;

generate_path : generate [=language:Java
    |Nothing
    |Php
    |RTCpp
    |SimpleCpp
    |Ruby
    |Python
    |Cpp
    |Json
    |StructureDiagram
    |Yuml
    |Violet
    |Umlet
    |Simulate
    |TextUml
    |Scxml
    |GvStateDiagram
    |GvClassDiagram
    |GvFeatureDiagram
    |GvClassTraitDiagram
    |GvEntityRelationshipDiagram
    |Alloy
    |NuSMV
    |NuSMVOptimizer
    |Papyrus
    |Ecore
    |Xmi
    |Xtext
    |Sql
    |StateTables
    |EventSequence
    |Umple
    |UmpleSelf
    |USE
    |Test
    |SimpleMetrics
    |PlainRequirementsDoc
    |Uigu2
    |ExternalGrammar] " [**output] " [=override:--override
    |--override-all]?
  ( [=suboptionIndicator:-s
    |--suboption] " [**suboption] "
  )* ;

// Use statements allow incorporation of other Umple files. See UseStatements
useStatement : use [use] ( , [extraUse] )*

// Namespaces divide the code into logical groups. See NamespaceDirectives
namespace- : namespace [namespace] [[namespaceoption]]? ;

// The main top level elements to be found in an Umple file
entity- : [[mixsetIsFeature]]
    | [[requireStatement]]
    | [[mixsetDefinition]]
    | [[classDefinition]]
    | [[traitDefinition]]
    | [[fixml]]
    | [[interfaceDefinition]]
    | [[externalDefinition]]
    | [[associationDefinition]]
    | [[associationClassDefinition]]
    | [[stateMachineDefinition]]
    | [[templateDefinition]]
    | [[enumerationDefinition]]
    | [[toplevelCodeInjection]]