N-ary associations / Ternary Association in java

N-ary association means associations among three or more classes.

A ternary association is an association with three roles that cannot be restated as binary associations.

The notation for a ternary association is a large diamond; each associated class connects to a vertex of the diamond with a line.

The above figure represents another example of Ternary Association.

You should try to avoid n-ary associations.

Normally it is decomposed into binary associations with possible qualifiers and attributes.

Many relationships invoke just two things and can be modeled with the simple binary association.

It is not however uncommon for three or more things to be involved in a relationship.

An n-ary association can be used in these circumstances and allow any or "n" numbers of things to be related in a single cohesive group.

An n-ary association is used when the three or more things are all related to each other in a structural or behavioral way.

It does not replace the use of two binary associations where a classifier is related to two other classifiers, but the latter two classifiers aren't related to each other.