我有一组对象(MyObject 类)。每个对象由三个名为type, instance,的字符串标识name。我将调用这些字符串description。我想创建一种机制来根据部分description或完整的description. 如果我有以下对象:
Object 1. has type:myType; instance:myInstance; name:myName;
Object 2. has type:myType; instance:myInstance2; name:myName2;
Object 3. has type:myType2; instance:myInstance3; name:myName3;
Object 4. has type:myType2; instance:myInstance3; name:myName4;
我要那个
get("myType") returns objects 1. and 2.
get("myType").get("myInstance") returns object 1.
get("myType2").get("myInstance3") returns objects 3. and 4.
get("myType2").get("myInstance3").get("myName4") returns object 4.
我的同事向我解释了如何实现这一点,但我不明白:| 他画了下图

这张图上的什么地方MyObject?应该MyObject聚合A,B还是C反之亦然?