Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: SObject record collection #69

Merged
merged 2 commits into from
Dec 31, 2024
Merged

feat: SObject record collection #69

merged 2 commits into from
Dec 31, 2024

Conversation

nkskaare
Copy link
Contributor

Summary

This pull request introduces significant updates to the RecordCollection class in the src/apex/utils/classes/RecordCollection.cls file. The main changes involve improving type safety and adding new functionality to handle records based on specific fields.

Key changes include:

Type Safety Improvements:

  • Removed the sObjectType member and added validation to ensure that the records list has a defined sObjectType in the RecordCollection constructor. Introduced a new TypeException class to handle type-related errors.
  • Updated the add methods to include type checks, ensuring that only records or collections of the same sObjectType can be added to the RecordCollection.

New Functionality:

  • Added a segmentOnField method that segments the records in the RecordCollection based on a specified field, returning a map of field values to lists of records.

These changes enhance the robustness and flexibility of the RecordCollection class, making it easier to manage and manipulate collections of SObjects while ensuring type consistency.

@nkskaare nkskaare merged commit 7de9ad3 into main Dec 31, 2024
0 of 2 checks passed
@nkskaare nkskaare deleted the feat-collection branch December 31, 2024 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant