Home > DeveloperSection > Forums > What is Aggregation and how it maps into a Java class?
Rajesh Goswami

Total Post:29

Points:203
Posted on    April-16-2011 1:25 AM

 Java Java 
Ratings:


 1 Reply(s)
 1567  View(s)
Rate this:
Aggregation show the part of relationship how use it in java or mapping with java class?


Amit Singh

Total Post:103

Points:721
Posted on    April-16-2011 2:49 AM

An Aggregation is an Association which denotes an "is part of" relationship.

Take a 'Car', for example, it is consisted of an engine,a steering wheel, four tires,seats,gear box,fuel tank,engine oil tank, air filters etc.So all constituents of car are parts of it.

If a car is destroyed/smashed, its parts can still be used separately as spares in other cars,so these parts have individual use even when their conatiner entity is destroyed.

Example
class Car
{
List getTires();
List getSeats();
List getAllParts();
}

Modified On Apr-16-2011 02:55:32 AM

Don't want to miss updates? Please click the below button!

Follow MindStick