-
Book Overview & Buying
-
Table Of Contents
Apex Design Patterns
By :
The prototype design pattern is used to create a new object of a class based on an existing object of the same class. It helps avoid the repetitive code used to initialize a newly created object.
Developers of Universal Call Center solved many problems associated with the creation of an object, using design patterns, such as the factory method, singleton, abstract factory method, and builder pattern. Now, they are confident about how to simplify, manage, and solve problems created while instantiating objects. They were working on the module of an application where they needed to create a duplicate copy of the Apex helper class used to perform various operations.
The following is a code snippet of a wrapper class, which simply sets and gets the Opportunity object:
public class OpportunityWrapper {
private Opportunity opp ;
public void setOpportunity(Opportunity o){
opp = o ;
}
public Id getOpportunityId()
{
...
Change the font size
Change margin width
Change background colour