Skip to content

Conversation

@jeesparza2
Copy link

Hi Kevin, came across this class in one of my client's projects. Noticed that the logic could be reduced slightly by using out of the box variables. Hope this helps, and thanks for the great framework.

- Removed static constructor, and instantiated static variables by themselves. - Removed redundant variables - Refactored code to make it more readable - Removed setTriggerContext method by using out of the box enumerator - Removed nested enumerator class
Fixed class to cover changes made to main class on Logic Redux Change. Removed unnecessary comments.
private static Map<String, LoopCount> loopCountByTrigerHandlerName = new Map<String, LoopCount>();
private static Set<String> bypassedHandlers = new Set<String>();

public TriggerHandler(System.TriggerOperation triggerEvent) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeesparza2 It looks like you're requiring passing in the trigger event each time - changing the constructor. This is a breaking change, so nobody can update code to use the latest version if your PR is merged and they copy/paste your code over existing code.

Perhaps you can add your constructor as another option but leave the old code - that way it's not a breaking change.
Please also update documentation. There is a readme file and some other documentation.

(Shameless plug: If you'd like to do that on my repo, I'd include your additional constructor in that. https://github.com/dschach/salesforce-trigger-framework)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants