I am using gson to serialize my classes. I have some properties that implements an exclusion strategy to avoid circular references. Here is a simple example:
class A{
B b;
}
class B implements ExclusionStrategy{
A a
String str;
... implements exclusion strat for class A
}
However, the exclusion strat on A is not called. It still tries to serialize property A in class B. Any ideas on how I can accomplish this? If I just try to serialize class B, it works, so I know the exclusion strat works.
It just doesnt seem to be applied to properties of the containing class. Perhaps there is something I need to add to class A so it knows some of its properties do contain exclusion strategies?
EDIT:
The resulting JSON should look something like:
{
B
{
'str':'some str'
}
}