开发者

Java getter/setter generation with Lombok for code with annotations

I use Project Lombok to automatically generate getter and setter methods for all fields of a Java class.

When a field is annotated with e.g. @XmlTransient, the annotation is not propagated to the generated getter/setter methods, thus in the resulting code it does not show any开发者_如何学Python effect. Is there a way to use automatic getter/setter generation in conjunction with further annotations?


I don't think propagating annotations to getter/setter methods would work in the general case. For example do you know what would happen if both the field and the bean properties were annotated with @XmlElement? For JAXB annotations I would suggest using @XmlAccessorType(XmlAccessType.FIELD) on the field.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜