Utilities for code generation using Java Xtend.
Create Jackson annotated classes with @JsonData
and @JsonDataField
. For example, replace the boilerplate heavy:
public class Message {
private final long time;
private final String text;
@JsonConstructor
public Message(@JsonProperty("time") long time, @JsonProperty("text") String text){
this.time = time;
this.text = text;
}
@JsonProperty("time")
public long getTime(){
return time;
}
@JsonProperty("text")
public String getText(){
return text;
}
}
with:
@JsonData class Message {
@JsonDataField("time") long time
@JsonDataField("text") String text
}
which also handles toString, hashCode and equals, if not implemented.