...
/Serialization and Data Management in Model Code
Serialization and Data Management in Model Code
Let’s learn how to write the serialization function and how to perform data management for the application.
We'll cover the following...
Write a serialization function
The object serialization function toString()
now needs to include the values of enumeration attributes.
Press + to interact
class Book {...toString() {return "Book{ ISBN:" + this.isbn + ", title:" + this.title +", originalLanguage:" + this.originalLanguage +", otherAvailableLanguages:" +this.otherAvailableLanguages.toString() +", category:" + this.category +", publicationForms:" +this.publicationForms.toString() + "}";}...}
Notice that for multi-valued enumeration attributes, we call the toString()
function predefined for JS arrays.