I have an issue with the Gson library, and I found your library, which looks that can suit almost all my needs, except for this one, the possibility to reuse already parsed objects, for example, lets say you have this json:
{
"data" : [
{
"id" : 1
"type" : "student"
"name" : "Student 1",
"subjects" : [
{
"id": 1,
"type" : "subject"
}
]
},
{
"id" : 2
"type" : "student"
"name" : "Student 2",
"subjects" : [
{
"id": 1,
"type" : "subject",
"name" : "Math"
}
]
},
{
"id" : 3
"type" : "office"
"name" : "student 3",
"subjects" : [
{
"id": 1,
"type" : "subject",
"name" : "History"
},
{
"id": 2,
"type" : "subject",
"name" : "History"
}
]
}
]
}
This is a very basic example, there are 3 students who assist to 0 or many classes. As you can see 2 or more students can have the same reference to an specific subject, but when I parse the object, Student 1 will have an object for subject 1, Student 2 will have a different object but with same information as the one for Student 1, so my question basically is, can this be achieved using the post-processors you have?
In theory what comes to mind is that before creating an object instance, there should be some kind of pool, so I look using the id and type, if I find the object I return it, otherwise I let the parser to create the instance for me. Do you have something for that case? Looks like its something between the Preprocessor and the Post-processor where you generate the actual Class.
I will appreciate any help or thoughts on this.