java - Why can't take Annotation on a Field together with getField() and setField()? -


example throw exception below, example b successful.

why can't take annotation on field getfield() , setfield()?
pojo should have field, get(), set().

com.sun.xml.internal.bind.v2.runtime.illegalannotationsexception: 1 counts of illegalannotationexceptions class has 2 properties of same name "wodogname"     problem related following location:         @ public java.lang.string wodog.pojo.wodog.getwodogname()         @ wodog.pojo.wodog     problem related following location:         @ private java.lang.string wodog.pojo.wodog.wodogname         @ wodog.pojo.wodog 

example a:

@xmlelement(name = "wodogname") private string wodogname;  public string getwodogname() {     return wodogname; }  public void setwodogname(string wodogname) {     this.wodogname = wodogname; } 

example b:

@xmlelement(name = "wodogname") private string wodogname;  public void setwodogname(string wodogname) {     this.wodogname = wodogname; } 

you have annotate class @xmlaccessortype(field) instruct jaxb use annotations specified on fields.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -