/***
 * Excerpted from "Domain-Driven Design Using Naked Objects",
 * published by The Pragmatic Bookshelf.
 * Copyrights apply to this code. It may not be used to create training material, 
 * courses, books, articles, and the like. Contact us if you are in doubt.
 * We make no guarantees that this code is fit for any purpose. 
 * Visit http://www.pragmaticprogrammer.com/titles/dhnako for more book information.
***/
private List<Car> cars = new ArrayList<Car>();
@MemberOrder(sequence = "1")
public List<Car> getCars() {
    return cars;
}
public void setCars(final List<Car> cars) {
    this.cars = cars;
}
public void addToCars(final Car car) {
    // check for no-op
    if (car == null || getCars().contains(car)) {
        return;
    }

    // dissociate arg from its current parent (if any).
    car.clearOwningCustomer();
    // associate arg
    car.setOwningCustomer(this);
    getCars().add(car);

    // additional business logic
    onAddToCars(car);
}
public void removeFromCars(
        final Car car) {
    // check for no-op
    if (car == null || !getCars().contains(car)) {
        return;
    }

    // dissociate arg
    car.setOwningCustomer(null);
    getCars().remove(car);

    // additional business logic
    onRemoveFromCars(car);
}
protected void onAddToCars(final Car car) {
}
protected void onRemoveFromCars(final Car car) {
}
