Reputation: 268
I have a class:
public class SomeClass {
public String a = "tag"
@JacksonXmlProperty(isAttribute = true)
public String b = "attribute"
}
I need to set variable b
as a property of variable a
:
<SomeClass>
<a b="attribute">tag</a>
</SomeClass>
I tried @JacksonXmlProperty(isAttribute = true)
, but it maps my attribute only to the root tag:
<SomeClass b="attribute">
<a>tag</a>
</SomeClass>
It there a way to handle this problem with annotations?
Upvotes: 0
Views: 1292
Reputation: 58862
Create a new class A
public class A {
@JacksonXmlProperty(isAttribute = true)
public String b = "attribute"
}
And use it in your class:
public class SomeClass {
@JacksonXmlProperty
public A a = "tag"
}
Upvotes: 1