Apex Docs – Automating Documentation for Salesforce Applications – Don't Be Lazy!



Apex Docs – Automating Documentation for Salesforce Applications – Don't Be Lazy!

0 0


salesforce-apex-documentation

Generating Apex Documentation with ApexDocs. Presentation given at DC Salesforce Dev Meetup Mar 2016 event. http://scottbcovert.github.io/salesforce-apex-documentation

On Github scottbcovert / salesforce-apex-documentation

Apex Docs

Automating Documentation for Salesforce Applications

Presented by Scott Covert / @scottbcovert

Don't Be Lazy!

Don't let the next developer want to do this to you!

JavaDoc Meets Salesforce

/**
* @author Scott Covert
* @date 3/14/2016
* @description Helper Methods for Account Trigger Handling
*/
public with sharing class AccountHelper {
	
    /** Constant representing Salesforce Website */
    private static final String salesforceSite = 'www.salesforce.com';

    /**
    * @author Scott Covert
    * @date 3/14/2016
    * @description Updates website field of given accounts to the Salesforce homepage
    * @param List A list of accounts that should have their website field updated
    * @return List A list of accounts with their website field set to the Salesforce homepage
    */
    public static List<Account> updateWebsiteToSF(List<Account> accountList){
        for(Account acct : accountList) {
            acct.Website = salesforceSite;			
        }				
        return accountList;
    }
}
  • ApexDocs was first developed by Aslam Bari and later improved by Steve Cox
  • Note the annotations used by ApexDocs: author, date, description, param, and return
  • Single-line comments will be interpreted as descriptions for class properties

Ant Friendly

<!-- Generate Docs -->
<target name="docs">
    <delete dir="${basedir}/Documentation" />
    <mkdir dir="${basedir}/Documentation" />
    <java fork="true" failonerror="true" jar="lib/SfApexDoc.jar">
        <arg line="-s src/classes -t Documentation/ -a docAuthor.txt -h docHome.txt -p global,public,private,protected" />
    </java>
</target>
  • You can easily create an Ant target for executing ApexDocs after you've included the SfApexDoc.jar file in your project's lib folder

Resources

  • For additional information and resources please see Steve Cox's GitLab repository

Source

Apex Docs Automating Documentation for Salesforce Applications Presented by Scott Covert / @scottbcovert