public abstract class SoftwareComponent {
private Set<Information> generateInfo = new HashSet<Information>();
private Set<Information> consumeInfo = new HashSet<Information>();
public Set<Infomation> getGeneratedInfo() { ... }
public Set<Information> getConsumedInfo() {....}
}
public class SensorDriver extends SoftwareComponent {
}
public class Information { ... }
public class SensorMeasurement extends Information { }
public class command extends Information { }
Above mentioned code is my program Structure. Now, the situation is Sensor Driver inherits
all its parent class method. I want to limit the scope of overridden Method in the sensor driver.
The limit is
“Sensor driver” can only generate “Sensor Measurement” information.
“Sensor driver” is not allowed to consume “Command” information.
You can make your SoftwareComponent generic and make Information a parameter: