function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shishir VKShishir VK 

Which construtor is initiated when Json seralizes data to Apex Bean Class

Hi ,

I am trying to do the follwoing :
  • Get data into apex class in Json format
  • Serialize the Json to a list of Aexp bean**  class (List<MyApexBeanClass> )
I am able to execute the above 2 steps successfully , Next
  • In the constructor of the Bean Class, validate the values being assigned to fields
I tried writting the validation in the constructor (Both Args and NO-Args constructor) , but both these constructor were not invoked when Json class serialize the data to the List of apex class  .

This pattern will allow us to not loop through the instances in the list.

Has anyone come across this kind of apex pattern ? Or has anyone solved anything simillar to this one?

Kindly suggest