Some Summer ’12 Apex Highlights

A few things that stood out for me in the Summer ’12 Release Notes:

  • There is now a Type.newInstance method that allows an object instance to be created starting from a class name string. This mechanism is key to building managed packages that are open for extension by external code: the managed package works to an interface, external code provides a class that implements that interface, and the name of the external code class is set via e.g. a managed package custom setting. See Wanted: the ability to create an instance of an Apex class from the class name for some more background and the comments for the current work-around.
  • It is now possible to run code on package install or upgrade/uninstall by implementing Apex code that implements the InstallHandler/UninstallHandler interfaces. This should allow some manual installation steps to be replaced by automatically run code.
  • There is now support for a Comparable interface providing more freedom in sorting though with the significant penalty that the implementing class needs to be made global.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s