How to call subclass method from superclass and assign superclass type into sub class by dynamically?

Real Case Scenario

There are two DTO classes which for transferring data having common properties.
With these common properties need to do some business logics which cover more than 1000 lines of code and update the present DTO and return as result.

Data receiving and sending from server in the form of above DTO and that can only predict at run time which DTO is this.


Below structure using for implementing the same with maximum code reusability.


Here only embossing how can call subclass method from superclass and ensure only accepting the POJO class which have common nature. 

In abstract class have comment which saying where need to add common logics, or call a common utility class.

Class hierarchy


Data sharing POJO class

  


Code Snippet of POJO Class




Super Class Code Snippet









Specific Classes(Subclasses)


Test Run Class
















Comments