list of dots

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 result in inclusion of 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 us 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- : [[glossary]]
    | [[generate]]
    | [[distribute]]
    | [[generate_path]]
    | [[filter]]
    | [[useStatement]]
    | [[namespace]]
    | [[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
    |Php
    |RTCpp
    |SimpleCpp
    |Ruby
    |Cpp
    |Json
    |StructureDiagram
    |Yuml
    |Violet
    |Umlet
    |Simulate
    |TextUml
    |Scxml
    |GvStateDiagram
    |GvClassDiagram
    |GvFeatureDiagram
    |GvClassTraitDiagram
    |GvEntityRelationshipDiagram
    |Alloy
    |NuSMV
    |NuSMVOptimizer
    |Papyrus
    |Ecore
    |Xmi
    |Xtext
    |Sql
    |Umple
    |UmpleSelf
    |USE
    |Test
    |SimpleMetrics
    |Uigu2] ( [=suboptionIndicator:-s
    |--suboption] " [**suboption] " )* ;

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

// Use statements allow incorporation of other Umple files. See UseStatements
useStatement : use [use] ;

// 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]]