Generalization mapping for Java (Java code)
ACS generates an extends or implements statement for a Generalization, depending on whether the linked items are Classes, Data Types or Interfaces.
The following table summarizes when extends or implements statements are generated.
Super item
Sub item
Generates
Class
Class
extends statement
Class
Interface
not applicable
Interface
Class
implements statement
Interface
Interface
extends statement
Data Type
Data Type
extends statement
For Super Classes
For a Super Class and Sub Class, ACS generates an extends statement in the Java file that is generated for the Sub Class, unless the Sub Class' Java Extends Text tag definition (applied by the «Java Class» stereotype) has a value set. If the Java Extends Text tag definition has a value set, that value is generated as the extends statements and the Generalization is ignored.
Example code:
public class Class2
extends Class1
{

}
If a Class has multiple Super Classes, ACS generates an extends statement for only the first Super Class it processes, unless the Sub Class' Java Extends Text tag definition (applied by the «Java Class» stereotype) has a value set. If the Java Extends Text tag definition has a value set, that value is generated as the extends statements and the Generalization is ignored.
For Super Data Types
For a Super Data Type and Sub Data Type, ACS generates an extends statement in the Java file that is generated for the Sub Data Type, unless the Sub Data Type's Java Extends Text tag definition (applied by the «Java Class» stereotype) has a value set. If the Java Extends Text tag definition has a value set, that value is generated as the extends statements and the Generalization is ignored.
If a Data Type has multiple Super Data Types, ACS generates an extends statement for only the first Super Data Type it processes, unless the Sub Data Type's Java Extends Text tag definition (applied by the «Java Class» stereotype) has a value set. If the Java Extends Text tag definition has a value set, that value is generated as the extends statements and the Generalization is ignored.
For Super Interfaces
For a Super Interface and Sub Interface, ACS generates an extends statement in the Java file that is generated for the Sub Interface, unless the Sub Interface's Java Extends Text tag definition (applied by the «Java Class» stereotype) has a value set. If the Java Extends Text tag definition has a value set, that value is generated as the extends statements and the Generalization is ignored.
Example code:
public interface Class1
extends Class2
{
}
For a Super Interface and a Sub Class, ACS generates an implements statement for the Sub Class, unless the Sub Class' Java Implements Text tag definition (applied by the «Java Class» stereotype) has a value set. If the Java Implements Text tag definition has a value set, that value is generated as the implements statements and the Generalization is ignored.
Example code:
public class Class2
implements Class1
{

}
* 
If a Class implements an Interface, we recommend that you model this relationship in Modeler through a Dependency (of type Abstraction) rather than a Generalization.
If a Class has multiple Super Interfaces, ACS generates an implements statement for the Super Interfaces.
Example code:
public class Class4
implements Class1, Class2, Class3
{
}
Properties:
All Generalization properties are ignored.
Tag Definitions:
The following Tag Definitions are applied to a Generalization by the «Java Extends» stereotype:
If the tagged value of the Java Actual Arguments tag definition has been set, ACS generates the value as arguments for the extends statement.
If the tagged value of the Java Needs Qualified Type tag definition is set to TRUE, ACS generates the data type with a qualified name.
Was this helpful?