Cardinality detection



EclipseUML Reverse Engineering Engine is capable to detect two groups of associations:

 

To classify an attribute type to one of the two groups; the key issue is container detection. In Java, there are two categories of containers: java.util.Collection and java.util.Map. EclipseUML reverse engineering implements a mechanism to recognize not only the interface java.util.Collection and java.util.Map, but also their subtypes or implementation classes such as java.util.List, java.util.Vector, java.util.Hashtable.

 

Cardinality 0...1 or 1

For a simple reference, if the attribute is always initialised, the cardinality will be 1. Otherwise, it will be 0..1.

 

Examples of cardinality 0..1

 

Before Reverse Engineering

After Reverse Engineering

public class Employee extends Person

{

    private Company company;

 

    public Company()

    {

    }

}

public class Employee extends Person

{

    /**

     * @uml property=company associationEnd={multiplicity={(0 1)}

     * }

     */

    private Company company;

 

    public Company()

    {

    }

}

 

Example of cardinality 0..1

 

Before Reverse Engineering

After Reverse Engineering

public class Employee extends Person

{

    private Company company;

 

    public Company(Company company)

    {

        this.company = company;

    }

}

public class Employee extends Person

{

    /**

     * @uml property=company associationEnd={multiplicity={(1 1)}

     * }

     */

    private Company company;

 

    public Company(Company company)

    {

        this.company = company;

    }

}

 

 

Cardinality 0...*

A container has always the cardinality 0..*.

 

Example of collection

 

Before Reverse Engineering

After Reverse Engineering

public class Company

{

    private Collection employees = new ArrayList();

   

}

public class Company

{

    /**

     * @uml property=employees associationEnd={multiplicity={(0 -1)}

     * inverse={company:model.Employee}

     * }

     */

    private Collection employees = new ArrayList();

   

}

 

 

 
Last update Fri Mar 05 14:18:13 CEST 2004 All text, graphics © 2002-2004 by Omondo