Mixing jackson core annotations and jaxb annotations when using jersey

By : Brian
Source: Stackoverflow.com
Question!

I have a method in a jaxb annotated class that I want to marshall a value if and only if it is marshalling to JSON with jersey 1.16 - which is using jackson 1.9 underneath. I was hoping to use @XmlTransient from jaxb and @JsonProperty from jackson on getting this done in a way like this:

@XmlRootElement
public class SomeClass {  

  // Other XmlElement annotated methods

  @XmlTransient
  @JsonProperty(value="type")
  public String getType(){
      return this.type;
  }

}

... but it doesn't seem to marshall at all. No errors are encountered.

By : Brian


Answers
Sign up using Google

By : Brian


This video can help you solving your question :)
By: admin