Optional parameter with UML class diagram -


is there official syntax specifying optional parameter of method in uml class type diagram?

for example, have method:

public function abc( $arg = 0) { ... return void; } 

how indicate $arg optional parameter , default value?

uml 2.5 has following definition parameterlist

  • <parameter-list> list of parameters of operation in following format: <parameter-list> ::= <parameter> [‘,’<parameter>]* <parameter> ::= [<direction>] <parameter-name> ‘:’ <type-expression> [‘[‘<multiplicity>’]’] [‘=’ <default>] [‘{‘ <parm-property> [‘,’ <parm-property>]* ‘}’]

where:

  • <direction> ::= ‘in’ | ‘out’ | ‘inout’ (defaults ‘in’ if omitted).
  • <parameter-name> name of parameter.
  • <type-expression> expression specifies type of parameter.
  • <multiplicity> multiplicity of parameter. (see multiplicityelement – sub clause 7.5).
  • <default> expression defines value specification default value of parameter.
  • <parm-property> indicates additional property values apply parameter.

so can use

+ abc($arg : integer = 0)

the type expression not optional can't leave out, guess can think of convention use unspecified


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -