The Professional Edition of Poseidon comes with four options for code generation and one for documentation generation (UMLDoc). Java code generation is the default setting, but you can also choose to generate CORBA IDL, Visual Basic .NET or C# code. To do this, you have to activate the plugin that supports the desired language. (Via Plugins -> Plugins Panel). When you do this, a set of stereotypes becomes available that can be used to control the result of the code generation. The next sections describe what stereotypes and tagged values you can use to control the output of code generation.
Uses the standard UML 'Class'
Supports single inheritance only
Class Signature
Additional visibilities for class signatures are set when the tagged values below are 'true':
internal
sealed
Class Attributes
Additional visibilities for class attributes are set when the tagged values below are 'true':
internal
protected internal
volatile
Class Operations
Additional visibilities for class operations are set when the tagged values below are 'true':
internal
protected internal
override
sealed
extern
virtual
Everything else will use the checked visibility radio buttons
Uses the standard UML 'Interface'
Supports single inheritance only
Interface Signature
Additional visibilities for interface signatures are set when the tagged value below is 'true':
internal
Interface Members
All interface members implicitly have public access. It is a compile-time error for interface member declarations to include any modifiers. In particular, interface members cannot be declared with the modifiers abstract, public, protected, internal, private, virtual, override, or static.
Everything else will use the checked visibility radio buttons.
Uses the standard UML 'Class' with the <<struct>> stereotype
Supports single inheritance only
Structure Signature
Additional visibilities for structure signatures are set when the tagged value below is 'true':
internal
Struct tapes are never abstract and are always implicitly sealed. The 'abstract' and 'sealed' modifiers are therefore not permitted in a struct declaration. Since inheritance isn't supported for structs, the declared accessibility of a struct member cannot be 'protected' or 'protected internal'.
Structure Members
Function members in a struct cannot be abstract or virtual, and the override modifier is allowed only to override methods inherited from the type System.ValueType. A struct may be passed by reference to a function member using a 'ref' or 'out' parameter.
Everything else will use the checked visibility radio buttons.
Uses the standard UML 'Class' with an <<enum>> stereotype
By default, it generates an enum as type 'int'.
Enum does not participate in generalizations or specifications
Enum cannot have navigable opposite association ends, operations, or inner classifiers
Anything else will default to 'int'.
Enumeration Signature
Additional visibilities for enumeration signatures are set when the tagged value below is 'true':
internal
Everything else will use the checked visibility radio buttons.
Uses the standard UML 'Class' with a <<delegate>> stereotype
Delegate does not participate in generalizations or specifications
Delegate Signature
Additional visibilities for the delegate signatures are set when the tagged value below is 'true':
internal
Everything else will use the checked visibility radio buttons.
Everything is modeled using the standard UML ‘Class’ with an appropriate stereotype as defined by UML Profile for CORBA
For details about modeling CORBA IDL, refer to the UML Profile for CORBA v1.0
Uses the standard UML 'Class' with the <<CORBAInterface>> stereotype
Interface member has to be 'public'
Uses the standard UML 'Class' with the <<CORBAValue>> stereotype
Can only specialize one other concrete CORBA Value
CORBA Value can only have 'public' or 'private' attributes and navigable opposite association ends
CORBA Value's 'Factory' method is modeled using the <<CORBAValueFactory>> stereotype with an Operation
CORBA Value can have only 0 or 1 <<CORBAValueFactory>>-stereotyped Operation
CORBA Value can only have 'public' operations
Uses the standard UML 'Class' with the <<CORBAStruct>> stereotype
CORBA Struct cannot participate in generalizations or specifications
CORBA Struct can have only 'public' attribute and navigable opposite association end of single multiplicity
CORBA Struct cannot have operations
Uses the standard UML 'Class' with the <<CORBAEnum>> stereotype
CORBA Enum cannot participate in generalizations or specifications
CORBA Enum can have only 'public' attributes
CORBA Enum cannot have navigable opposite association ends
CORBA Enum cannot have operations
Uses the standard UML 'Class' with the <<CORBAException>> stereotype
Due to current Poseidon limitations, CORBA Exception names must end in the string 'Exception'
CORBA Exception cannot participate in generalizations or specifications
CORBA Exception can have only 'public' attributes with single multiplicity
CORBA Exception cannot be an end of a navigable association end
CORBA Exception cannot have operations
Uses the standard UML 'Class' with the <<CORBAUnion>> stereotype
CORBA Union cannot participate in generalizations or specifications
CORBA Union can not have operations
There are two ways to model CORBA Union as specified in UML Profile for CORBA:
Using a composition relationship that points to a 'switcher' and has the <<switchEnd>> stereotype. Every attribute must have a tagged value with 'Case' as the key and the switch condition as the value.
Using an attribute with the <<switch>> stereotype attribute acting as the 'switcher' in conjunction with a composition relationship. The navigable opposite association ends must have tagged values with 'Case' as the key and the switch condition as the value.
Please see UML Profile for CORBA v1.0 §3.5.15 for more details.
'package' visibility will be translated into 'Friend'
'abstract' will be translated into 'MustInherit' or 'MustOverride'
'final' will be translated into 'NotInheritable' or 'NotOverridable'
'static' will be translated into 'Shared'
The following keys for tagged value pairs are supported when the value has been set to 'true' within the appropriate context:
Shadows
Overridable
Protected Friend
Uses the standard UML 'Class'
Supports single inheritance only
'Protected Friend' visibility is determined by setting the tagged value 'Protected Friend' to 'true'. Everything else will use the checked visibility radio button.
Classes with abstract operations must also be declared 'abstract'
Uses the standard UML 'Interface'
Interface identifiers must start with the 'I' character
Interface operations must be ‘Public’ and cannot be 'Shared'
Interfaces cannot have attributes or navigable opposite association ends
Uses the standard UML 'Class' with the <<Module>> stereotype
Modules cannot be 'abstract' or 'final'
Modules cannot participate in generalization or specification
Modules cannot be an inner classifier or have an inner classifier
Modules cannot have a 'Protected' or 'Protected Friend' member
Uses the standard UML 'Class' with the <<Structure>> stereotype
Structures must have at least one member that is non-static (shared) and is either an attribute, a navigable opposite association end, or an operation with the stereotype <<Event>>.
Structures cannot have a 'Protected' or 'Protected Friend' member
Structures cannot have an attribute or navigable opposite association end with an initialized value
Uses the standard UML 'Class' with the <<Enum>> stereotype
By default, it generates an Enum as type 'Integer'
Enums do not participate in generalizations or specifications
Enums cannot have navigable opposite association ends, operations, or inner classifiers
Other Enum types are supported by using the tagged value key 'type' with one of the following values:
Short
Byte
Integer
Long
Anything else will default to 'Integer'
Operations support the following tagged values:
Protected Friend
Shadows
Overridable
Operations with no return parameter (returning 'void') are generated as 'Sub'
Operations with a return parameter are generated as 'Function'
Parameter type 'in' is translated as 'ByVal', everything else is 'ByRef'
The type 'ParamArray' is supported by using the stereotype <<ParamArray>> with a parameter
A 'ParamArray' parameter must be the last parameter
A 'ParamArray' parameter must be of type 'in' or 'ByVal'
Properties are supported with <<Property>> stereotyped operations
There are 3 type of stereotypes available:
'Property' will generate 'Get' and 'Set' inside the Property block
'ReadOnly Property' will generate only 'Get' inside the Property block
'WriteOnly Property' will generate only 'Set' inside the Property block
If no attribute is set in 'accessed attribute', it will by default generate an attribute with same type as the Property return type with the name set to 'm_operation_name'.
This guide is based on the PHP4 Manual, available at http://www.php.net/docs.php.
The only classifier in PHP4 is 'Class'.
PHP4 Class can not participate in an Association.
There is no Exception in PHP4
There are two files generated for each Class generation process:
'.inc' file that contains the class declaration
'.php' file that includes related the '.inc' on its first line
Uses standard UML 'Class'
Supports single inheritance only
There are no visibilities for Class Attributes
Tagged values supported:
Heredoc
Tagged value = '<<<', with value = 'true'
Will return anything typed in the initial value with Heredoc string type.
For example:
$str = <<<EOD Example of string spanning multiple lines using heredoc syntax. EOD; |
There are no visibilities for Class Operations
Tagged values supported:
Parameter initial value
Tagged value= 'initval', with value = (specified parameter initial value).
For example:
class ConstructorCart extends Cart { function ConstructorCart($item = "10", $num = 1) { $this->add_item ($item, $num); } } |
Parameter passed by reference
Tagged value='&' with value='true' in the parameter signature.
For example:
<?php function foo (&$var) { $var++; } $a=5; foo ($a); // $a is 6 here ?> |
Function returns a reference
Tagged value='&' with value='true' in the operation signature.
For example:
<?php function &returnsReference() { return $someref; } $newref =& returnsReference(); ?> |
All strings input in the Tag column are case-sensitive.
Classifier
Tag = 'uses' with Value = string that represents unit(s) name to be included in specified unit declaration, separated by comma.
Description: Handles strings that represent the names of units to be included in specified unit declarations. A 'uses' tag with a blank value will be defaulted to 'SysUtils'.
Example: UnitA, UnitB, UnitC
Tag = 'setvalue' with Value = string that represents the value of 'Set', separated by comma.
Description: Handles the way to input the value of the 'Set' type.
Example: 1,9
Tag = 'subrangevalue' with Value = string that represents the value of 'Sub Range' separated by comma.
Description: Handles the way to input the value of the 'Sub Range' type.
Example: 1,9
Tag = 'arrayvalue' with Value = string that represents the value of 'Array', separated by comma.
Description: Handles the way to input the value of the 'Array' type.
Example: 1,9
Tag = 'arraytype' with value = string that represents the type of 'Array'.
Description: Handles the way to input the type of the 'Array' type.
Attribute
Tag = 'published' with Value = 'true'.
Description: Handles the published visibility of the classifier 'attribute'.
Operation
Tag = 'published' with Value = 'true'.
Description: Handles the published visibility of the classifier 'operation'.
Tag = 'virtual' with Value = 'true'
Description: Handles the way to set the specified operation into a 'virtual' type operation.
Tag ='dynamic' with Value = 'true'
Description: Handles the way to set the specified operation into a 'dynamic' type operation.
Tag = 'override' with Value = 'true'
Description: Handles the way to set the specified operation into an 'override' type operation.
Tag = 'overload' with Value = 'true'
Description: Handles the way to set the specified operation into a 'overload'type operation.
Exception
Tag = 'published' with Value = 'true'.
Description: Handles the published visibility of 'Exception'.
Attribute
Stereotype = 'Const'
Description: Handles the way to specify a 'const' type Attribute.
Stereotype = 'property'
Description: This will handle the way to specify a 'property' type Attribute.
Operation
Stereotype = 'function'
Description: Handles the way to specify a 'function' type Operation.
Stereotype = 'procedure'
Description: Handles the way to specify a 'procedure' type Operation.
Classifier
Stereotype = 'Enum'
Description: Handles the way to specify an 'Enumeration' type Classifier.
Stereotype = 'Record'
Description: Handles the way to specify a 'Record' type Classifier.
Stereotype = 'Set'
Description: Handles the way to specify a 'Set' type Classifier.
Stereotype = 'SubRange'
Description: Handles the way to specify a 'Sub Range' type Classifier.
Stereotype = 'Array'
Description: Handles the way to specify an 'Array' type Classifier.
Stereotype = 'Exception'
Description: Handles the way to specify an 'Exception' type Classifier.
Class
Uses the standard UML Class
Participates in generalizations, associations and specifications
Only supports single inheritance
Interface
Uses the standard UML Interface
Participates in generalizations
Does not participate in associations or specifications
Only supports single inheritance
Enumeration
Uses the standard UML Class with << Enum >> stereotype
Does not participate in generalizations or specifications
Cannot have navigable opposite association ends or operations
Record
Uses the standard UML Class with << Record >> stereotype
Does not participate in generalizations or specifications
Can have navigable opposite association ends
Cannot have any operations
Set
Uses the standard UML Class with << Set >> stereotype
Does not participate in generalizations or specifications
Cannot have navigable opposite association ends or operations
Sub Range
Uses the standard UML Class with << SubRange >> stereotype
Does not participate in generalizations or specifications
Cannot have navigable opposite association ends or operations
Array
Uses the standard UML Class with << Array >> stereotype
Does not participate in generalizations or specifications
Cannot have navigable opposite association ends or operations
Exception
Uses the standard UML Class with << Exception >> stereotype
The same as Class
An attribute with 'non-1' multiplicity will generate an Array that is defaulted to type 'int' with Lower Bound and Upper Bound values based on the specified multiplicity.
Example: Attribute with multiplicity: 1..2 will generate : Array[1..2] of int;
A blank value with the 'uses' Tag, will be defaulted to 'SysUtils'.
A blank value with the 'setvalue' Tag will be defaulted to 'a'..'z'
A blank value with the 'subrangevalue' Tag will be defaulted to 'a'..'z'
A blank value with the 'arrayvalue' Tag will be defaulted to 1..10
A blank value with the 'arraytype' Tag will be defaulted to int
A blank value with the 'procedure' and 'function' Tag will be defaulted to procedure
The result of the code generation is saved as a Module file ( ClassName.pm )
Interfaces and their associations are not translated into Perl code
Abstracts and their associations are not translated into Perl code
Element’s documentation are translated into Perl comment syntax (# comment )
Attribute / Parameter types are ignored because there is no need to define data types for Perl variables
Uses the standard UML ‘Class’
Classes are translated into Perl Class (package className )
A constructor is generated for each class (sub new)
Attributes are translated into variables
Attributes with single multiplicity are translated into scalar type variables (my $AttributeName )
Attributes with multi-multiplicity are translated into array type variables (my @AttributeName )
An attribute with a tagged value 'local' that is set to 'true' is translated into 'local $AttributeName' instead of 'my $attribute'
An attribute that has non-1 multiplicity with a tagged value 'Map' set to 'true' is translated into '%AttributeName' instead of '@AttributeName'
When the visibility of an attribute is public, 'use vars qw ( $AttributeName )' is added to the code generation.
Operations are translated into Sub-routines ( Sub OperationName )
Parameters are translated into Sub-routine variables
Return value are not translated into Perl code
When an operation is static and has the stereotype << create >>, a 'BEGIN { } ' block is added to code generation.
When an operation is static and has the stereotype << destroy >>, a 'END { } ' block is added to code generation.