Romain Manni-Bucau created JOHNZON-87:
-----------------------------------------
Summary: support meta annotations
Key: JOHNZON-87
URL: https://issues.apache.org/jira/browse/JOHNZON-87
Project: Johnzon
Issue Type: New Feature
Reporter: Romain Manni-Bucau
Assignee: Romain Manni-Bucau
Fix For: 0.9.4
Idea is to allow end user to defined annotations from our annotations like in:
{code}
public class User {
@Id
private long id;
@Name
private String name;
@Custom
private String custom;
@Custom("set")
private String custom2;
@Ignored
private String name2;
public long getId() {
return id;
}
public void setId(final long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
public String getCustom() {
return custom;
}
public void setCustom(final String custom) {
this.custom = custom;
}
public String getName2() {
return name2;
}
public void setName2(final String name2) {
this.name2 = name2;
}
public String getCustom2() {
return custom2;
}
public void setCustom2(final String custom2) {
this.custom2 = custom2;
}
}
@Target(FIELD)
@Retention(RUNTIME)
@JohnzonProperty("id")
public @interface Id {
}
@Target(FIELD)
@Retention(RUNTIME)
@JohnzonIgnore
public @interface Ignored {
}
@Target(FIELD)
@Retention(RUNTIME)
@JohnzonProperty("name")
public @interface Name {
}
@Target(FIELD)
@Retention(RUNTIME)
@JohnzonProperty("ignored")
public @interface Custom {
String value() default "overriden";
}
{code}
see MetaMapperTest for the full code
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)