1
interface IShowModelTree{
ShowModel getTree();
}
Class MA101 implements IShowModelTree{};
Class MA301 implements IShowModelTree{};
Class AJ102 implements IShowModelTree{};
2
interface IGetTree{
ShowModel composeTree();
}
class MeterCallData implements IGetTree{};
class TerminalCallData implements IGetTree{};
class MeterCollectData implements IGetTree{};
3
Class MA101 implements IShowModelTree{
private IGetTree igetTree;
private MA101(IGetTree igetTree){
this.igetTree = igetTree;
}
ShowModel getTree(){
igetTree.composeTree();
}
}
4
public class Test{
public static void main(String[] args){
IShowModelTree tree = new MA101(new MeterCallData());
ShowModel result = tree.getTree();
}
}