PropagatorBuilder has a method named copy(). In my opinion, it could be a better implementation if the PropagatorBuilder interface extends the Cloneable interface with its methode clone(). In other words, the purpose is the same, but closer to Java.
Yes, but there is a workaround if the method is override inside the class implementing the interface.
public class Bunny implements Cloneable {
...
@Override
public Bunny clone() {
try {
Bunny cloned = (Bunny) super.clone();
// clone all the attributs that are not automatically cloned
return cloned;
catch (CloneNotSupportedException cnse) {
// bla bla bla
}
}
Resulting in:
Bunny newCuteBunny = bunny.clone();
I think that clone method can have a default implementation in AbstractPropagatorBuilder with specific implementations inside the classes with attributs not cloneable automatically.