The Decorator Pattern in Salesforce | Design Patterns | Salesforce
It attempts to solve the issue where you need temporary fields for processing (typically in Visualforce/LWC/Aura) but does not need to add these fields to the sObject.
Common uses for this pattern include:
- Selection Checkbox — a list of records that the user selects and applies behaviour to; the selection checkbox is not saved
- Calculated fields — a complex read-only value that cannot be easily done in a formula field (e.g. calculation of a check digit)
- Wrapper Class - When we wanted to store the data from multiple related or unrelated object
Responses