I can’t believe that I missed the introduction of the URL class in SalesForce.  Oh joy, at last.

This obviously leads to this code:


public class AnotherBoringUtilClass{

  public static string getUrl( Id Id ){

    return URL.getSalesforceBaseUrl().toExternalForm() + '/' + Id;

  }

}

Now if only we had extension methods like C# then this would be really cool.