Prototype
Example - Simple Prototype
class HumanCell implements Cloneable {
private String dna;
public HumanCell(String dna) {
this.dna = dna;
}
public String getDna() {
return dna;
}
// all complex objects must be recreated (lists, maps, POJOs)
public Object clone() throws CloneNotSupportedException {
return new HumanCell(dna);
}
}Example - Define own prototype interface
Last updated