简体   繁体   English

推土机映射布尔值

[英]Dozer mapping Booleans

I am using dozer and I can't map from boolean to Boolean. 我正在使用推土机,但无法从布尔值映射到布尔值。 What could be the problem? 可能是什么问题呢?

mapping xhtml 映射xhtml

<field>
    <a>test</a>
    <b is-accessible="true" >test2</b>
</field>

class a A级

private boolean test;

public boolean getTest(){
    return test;
}

class b B级

private Boolean test2;

public boolean isTest2(){
    return test2;
}

With dozer 5.4.0, the following worked for me 使用推土机5.4.0,以下对我有用

    <field>
        <a is-accessible="true" get-method="isFoo">foo</a>
        <b is-accessible="true" set-method="setFoo">foo</b>
    </field>

According to the documentation on Dozer, this should be possible: 根据推土机上的文档 ,这应该是可能的:

Data type coversion is performed automatically by the Dozer mapping engine. 数据类型覆盖由Dozer映射引擎自动执行。 Currently, Dozer supports the following types of conversions: (these are all bi-directional) 当前,推土机支持以下类型的转换:(这些都是双向的)

  • Primitive to Primitive Wrapper 原始包装到原始包装
  • ... ...

You can try if specifying set-method and get-method helps . 您可以尝试指定set-method和get-method help

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM