开发者

How to map a component collection with compass?

I need to map a collection of components with compass (using XML mapping)... Is there any way to achieve this? Thanks in advance for any suggestions.

Example classes:

class ClassA {
    private Set<ClassB> bs;
    // ... getBs/setBs ...
}
class ClassB {}

Example mapping:

<class name="com.package.ClassA" alias="classA">
     <!-- no idea开发者_开发知识库 how I can map Set<ClassB> in here... can I? -->
</class>
<class name="com.package.ClassB" alias="classB">
</class>


Yeah, just found out how to do this, the mapping is simple - you just apply the alias to the collection component/reference. Obviously all the rest is done implicitely.

<class name="com.package.ClassA" alias="classA">
     <component name="bs" ref-alias="classB" />
</class>
<class name="com.package.ClassB" alias="classB">
</class>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜