|
The constructor for CommandLineView constructs a RentABike using new RentABike - there is no concrete implementation of RentABike.
More importantly, clv does not have a setRentABike method, so the Assembler is not able to do the injection.
Also, I do not understand why CommandLineView has a main method.
CommandLineView should look more like this:
public class CommandLineView {
private RentABike rentaBike;
public CommandLineView( ) {
//nothing to do here
}
public void setRentABike(RentABike rentABike){
this.rentABike = rentABike;
}
public void printAllBikes( ) {
System.out.println(rentaBike.toString( ));
Iterator iter = rentaBike.getBikes().iterator( );
while(iter.hasNext( )) {
Bike bike = (Bike)iter.next( );
System.out.println(bike.toString( ));
}
}
}
I hope this helps
Russell
|