看来,如果该财产的存取人被定义为<条码>isProperty(<>,而不是<条码>>植被保护()。
The following groovy script show the problem:
import org.dozer.*
class ProductCommand {
Boolean foo
}
public class ProductDto {
private Boolean foo;
public Boolean isFoo() { this.foo }
public void setFoo(Boolean p0) { this.foo = p0 }
}
def mapper = new DozerBeanMapper()
dto = new ProductDto(foo: true)
assert dto.isFoo()
ProductCommand mappedCmd = mapper.map(dto, ProductCommand)
assert mappedCmd.foo
关于最后一行的说法失败了。 但是,如果我改名为ProductDto.isFoo()
至ProductDto.getFoo(
>。
Dozer绘图档案中是否有旗帜/图象,将指示它使用is
或get
进入海底房地产? 或者,我可以增加每个羊毛财产的习惯规则,但这并不是非常令人信服的。
Although the example above is written in Groovy, I ve no reason to believe the same behaviour wouldn t be exhibited by the equivalent Java code.
These DTOs are generated by JAXB (which generates an "is" accessor, rather than a "get" accessor for booleans), so I can t rename the accessors. I m using Dozer 5.3.2.