Lower : Integer (0 1) - source MultiplicityElement IsUnique : Boolean (1 1) - source MultiplicityElement IsOrdered : Boolean (1 1) - source MultiplicityElement ParameterSet : ParameterSet (0 *) - source Parameter Operation : Operation (0 1) - source Parameter IsStream : Boolean (1 1) - source Parameter IsException : Boolean (1 1) - source Parameter Of an invocation of a behavioral feature.Parameters have support for streaming,ĭirect Superclasses: MultiplicityElement, ConnectableElementĬlass Precedence List: Parameter, MultiplicityElement, ConnectableElement, TypedElement, NamedElement, ParameterableElement, Element Properties: default : String (0 1) - source ParameterĭefaultValue : ValueSpecification (0 1) - source Parameterĭirection : ParameterDirectionKind (1 1) - source ParameterĮffect : ParameterEffectKind (0 1) - source Parameter Is a specification of an argument used to pass information into or out I use parameterized classes in specification and implementation modeling only if they are supported by the language I am using.Class UML 2.4.1::Parameter Description: Parameters are allowed to be treated as connectable elements.A parameter (One case I do use it for is the Range pattern see Fowler 1997). I rarely use parameterized classes in conceptual modeling, mostly because they are used mainly for collections, which are implied by associations.
Uml editor parameterised class code#
Using parameterized classes does have repercussionsfor example, they can cause considerable code bloat in C++. This property is central to the use of parameterized classes in C++'s standard template library (STL) these classes can also be used for other interesting tricks. This is a derived typing mechanism because you do not have to define a type for the parameter the compiler figures out whether the binding is viable, by looking at the source of the template.
When you later declare a bound element, the compiler tries to ensure that the supplied parameter supports the operations required by the template. When you write the body of the template, you may invoke operations on the parameter. Parameterized classes allow you to use a derived typing. If you want to add features, you must create a subtype. You are not allowed to add features to the bound element, which is completely specified by its template you are adding only restricting type information. Using a bound element is not the same as subtyping, however. This fits the other way of implementing type-specific collections, which is to declare all appropriate subtypes. In specification terms, the EmployeeSet is a subtype of Set. This relationship indicates that EmployeeSet will conform to the interface of Set. The bind stereotype is a stereotype on the refinement relationship. The alternative notation (see Figure 6-20) reinforces the link to the template and allows you to rename the bound element. The first way mirrors the C++ syntax (see Figure 6-19). You can show a bound element in two ways. (You may have more than one.) In an untyped language, such as Smalltalk, this issue does not come up, so this concept is not useful.Ī use of a parameterized class, such as Set, is called a bound element.
The T in the diagram is a placeholder for the type parameter. You declare a parameterized class in the UML using the notation shown in Figure 6-18. When you have done this, you can use the general definition to make set classes for more specific elements.
This way, you can define behavior for sets in general by defining a template class Set. This concept is most obviously useful for working with collections in a strongly typed language. Several languages, most noticeably C++, have the notion of a parameterized clasys, or template.