Reputation: 705
Assuming the following JSON structure:
{
\"is_something\": false,
\"name\": \"Some Name\",
\"subtype\": {
\"total\": 0.0
}
}
Instead of creating two autobean interfaces (one for the whole structure and one for the subtype), I would like to have one which contains all the properties.
public interface ExampleAutoBean {
@PropertyName("is_something")
boolean isSomething();
String getName();
@PropertyName("subtype.total")
double getTotal();
}
So, the getTotal()
method is expected to contain the total
property of the nested subtype in the JSON structure. I can't find any documentation in the source code or online which states whether or not this is possible.
Thanks in advance!
Upvotes: 1
Views: 423
Reputation: 18346
Nope: AutoBeans are designed to be a mapping from the JSON structure to Java interfaces, plus or minus collections like List
, Set
, and Map
and String encodings of a long
or a Date
. Additionally, it is legal to have json like the following:
{
"some.property.with.dots" : "abcd",
"name" : "wxyz"
}
If the .
character could only be used for traversing into sub-objects, there would be no way to have a getter for the first property.
Upvotes: 4