Closed Padmahas closed 6 years ago
This is a similar situation as issue #134 where axis is generating extra fields. The dfp_appengine module handles generation a little cleaner and doesn't have these fields.
If are set on axis and want to convert these with Gson, you can add a custom ExclusionStrategy.
Hello @christopherseeley,
I wrote the below ExclusionStrategy as shown below But what I think happening here is, ExclusionStrategy will just prevent deserialization. But what I need is, deserialize Child class attribute without considering parent class attribute.
public class GsonLineItemDeserializer implements ExclusionStrategy
{
@Override
public boolean shouldSkipField(FieldAttributes f)
{
// TODO Auto-generated method stub
if (f.getName().equalsIgnoreCase("__equalsCalc") || f.getName().equalsIgnoreCase("__hashCodeCalc"))
return true;
return false;
}
@Override
public boolean shouldSkipClass(Class<?> clazz)
{
// TODO Auto-generated method stub
return false;
}
}
There won't be any errors while converting JSON to LineItem object. But when I give converted LineItem object to "AvailabilityForecast" as input by setting "ProspectiveLineItem", I'm getting multiple NullPointerException. Attached is the complete error log.
org.apache.axis.AxisFault: ; nested exception is: java.io.IOException: java.io.IOException: java.lang.NullPointerException
"dfp_appengine " is not an option because I couldn't find "PublisherQueryLanguage" and so many other services' implementation. Also we have developed the whole project using axis, now it will be very time consuming to change the package/module.
Any idea how to solve this problem?
Thank you.
Hello,
As I've read in so many StackOverflow posts its not good to declare same field in both Parent and Child classes. But since "__equalsCalc" field is declared in so many parent and child classes, as described in this thread, we are not able to convert LineItem JSON input received from frontend (AngularJS) to backend (Spring Boot) and convert to LineItem object. This issue arises when we receive LineItem as JSON string and try to convert it to LineItem object.
If we try to get Line Item as DFP LineItem object directly, then we are getting "Can not construct instance of com.google.api.ads.dfp.axis.v201708.StartDateTimeType: no suitable constructor found" as described in the first Approach of the same thread.
Please let me know how to get LineItem object from AngularJS to Spring Boot properly.
Thank you.