public abstract class Association
extends java.lang.Object
Represents: association
Usage:
An association in the model is a subclass of Association
, having
two inner classes which both extend AssociationEnd
. In case of simple
associations (not Composition
s), both of these ends have to be a
subtype of either Association.End
or Association.HiddenEnd
, which represent navigable
and non-navigable association ends, respectively.
When defining an association end, the type parameter of the extended association end type must be explicitly set, like in the example below. The collection type specified here will tell
Associations can be linked and unlinked with the appropriate actions, see
Action.link(java.lang.Class<? extends hu.elte.txtuml.api.model.AssociationEnd<CL>>, L, java.lang.Class<? extends hu.elte.txtuml.api.model.AssociationEnd<CR>>, R)
and Action.unlink(java.lang.Class<? extends hu.elte.txtuml.api.model.AssociationEnd<CL>>, L, java.lang.Class<? extends hu.elte.txtuml.api.model.AssociationEnd<CR>>, R)
for further information. The
collection of objects linked to a specific object can be obtained with the
ModelClass.assoc(java.lang.Class<AE>)
method as shown in the example below.
Java restrictions:
Subtype requirements:
AssociationEnd
Subtype restrictions:
AssociationEnd
.Example:
class A_B extends Association {
class a extends End<Any<A>> {}
class b extends HiddenEnd<One<B>> {}
}
Inside an operation of B
:
Any<A> anyOfA = this.assoc(A_B.a.class);
A a = anyOfA.one();
See the documentation of Model
for an overview on modeling in
JtxtUML.Association.End
,
Association.HiddenEnd
,
Composition
Modifier and Type | Class and Description |
---|---|
class |
Association.End<C extends GeneralCollection<? extends ModelClass>>
Abstract base class for navigable association ends.
|
class |
Association.HiddenEnd<C extends GeneralCollection<? extends ModelClass>>
Abstract base class for non-navigable association ends.
|
Constructor and Description |
---|
Association() |