You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-8Lines changed: 12 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Consts
2
2
3
-
Consts framework allows keeping apex's constants in an ordered way.
3
+
The Constants Framework provides a structured approach for managing constants in the Apex.
4
4
5
5
## Example
6
6
@@ -24,17 +24,21 @@ System.debug(Consts.OPPORTUNITY.TYPE.EXISTING_CUSTOMER_DOWNGRADE); //'Existing C
24
24
25
25
## How it works?
26
26
27
-
All concrete classes are created as *singletons*, so each class is initialized once during the transaction. To decrease heap size getters and setters are in use. It means that the class will be *initialized on demand*. e.g execution of `Consts.ACCOUNT.TYPE.PROSPECT` will create an instance of `AccountConsts` only, without creating `ContactConsts`.
27
+
The framework employs the concept of singletons to create concrete classes.
28
+
Each class is initialized once during the transaction, reducing heap size usage.
28
29
29
-
Code Architecture is following *Open/Close* and *Single Responsibility Principle*.
30
-
It means that code is easy to extend, and each class is responsible only for a specific set of consts.
30
+
Getters and setters are used to lazily initialize the classes.
31
+
For example, accessing `Consts.Account.TYPE.PROSPECT` will only create an instance of the `AccountConsts` class without creating `ContactConsts`.
32
+
33
+
The code architecture follows the Open/Closed and Single Responsibility Principle principles.
34
+
This design ensures the code is easily extensible, and each class is responsible for a specific set of constants.
31
35
32
36
## How to use it?
33
37
34
-
### Create concrete consts class
38
+
### Create a concrete consts class
35
39
36
-
-Create an `INSTANCE` variable to keep the class instance (singleton).
37
-
- Create inner classes to order values.
40
+
-Define an `INSTANCE` variable to hold the class instance (singleton).
41
+
- Create inner classes to organize the constant values.
0 commit comments