Apex code enhancements in Summer 10
Summer '10 is already in pre-release. I spent some time this morning looking at some of the Apex code enhancements and what they might mean to developers.
I've been reading through the Summer '10 release notes over the past few days looking for more nuggets of goodness. This morning I spent some time looking at the Apex code enhancements and wanted to share a few that caught my attention.
1. Sets can now take both Primitives and sObjects
Prior to Summer '10, Sets could only be used with primitives like an Integer. With Summer '10, you can create Sets of sObjects, such as Accounts, Contacts, or your own Custom Object. This is especially useful when you consider Sets are an unordered list that doesn't contain duplicates. Now I could pass a set back from my controller and render the results without worrying about duplicates, or writing code to handle it – nice.
2. New isFeedEnabled Method for DescribeSObjectResult
If you are one of the folks who have been active in the Chatter Dev Zone building Chatter apps, one of the things you may have wanted to do was use the describe calls to interrogate the schema to determine which objects are 'Chatter enabled' (those objects which have Feed tracking enabled) and do something as a result. isFeedEnabled will return true on any objects that have Chatter feeds enabled, and false if they do not.
3. sObject Clone now users the running user
Previously, whenever you used the sObject Clone method, the createdDate, and createdBy fields were cloned as well. Summer '10 now sets createdBy to be the user running the Apex code, and createdDate to be the current date and time. From experience developing integration solutions, this feature certainly assists in identifying which records are originals, copies, and who created them plus a bunch of other use cases such as additional logic in triggers, filtering SOQL queries and so on.
There are plenty more goodies hidden among the release notes; I just picked three I had personal interest in. (and hopefully you do too!) This afternoon I am going to look at some of the Visualforce enhancements like the View State Inspector.