vendredi 15 décembre 2017

java dollar symbol com.package.Foo.$$$.Bar issue

I am doing a webservice call and it responds with model class called Foo. Foo is not extending any other class.

Foo data = call(); 

I can access all data fields normally. String str = data.getData();

However if I do System.out.println(data.toString()); I am getting back the following output: com.package.Foo.$$$.Bar@2938ac9a

I suspect that web framework is doing some reflection magic around responses and wrapping it with proxy class. Since Bar is extending Foo on application level I can't notice anything and still can access all data I need. But...

Problem:

When I am trying to serialise Foo data; as a result I am getting a lot of unexpected data and fields.

I wonder if someone can explain me what does $$$ mean in java and how do I convert Bar object back to Foo?





Aucun commentaire:

Enregistrer un commentaire