开发者

How to map a component collection with compass?

开发者 https://www.devze.com 2023-01-09 15:25 出处:网络
I need to map a collection of components with compass (using XML mapping)... Is there any way to achieve this?

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

精彩评论

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