I use Project Lombok to automatically generate getter and setter methods for all fields of a Java class.
When a field is annotated with eg @XmlTransient
, the annotation is not propagated to the generated getter/setter methods, thus in the resulting code it does not show any 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.