ABSYZ ABSYZ

  • Home

    Home

  • About us

    Who We Are

  • Our Expertise

    What we Do

  • Our Approach

    How We Do It

  • Products

    What We Made

  • Industries

    Who We Do It For

  • Clients

    Whom We Did It For.

  • Article & Blogs

    What Experts Think

  • Careers

    Join The Team

  • Get In Touch

    Let’s Get Started

ABSYZ

Apex Documentation Using ApexDoc

Home / Article & Blogs / Apex / Apex Documentation Using ApexDoc
By Team ABSYZ inApex, Salesforce

Hi All,

Recently I was working for a requirement and got to know about Apexdoc for creating the documentation of all the classes in our org.

ApexDoc

ApexDoc is a java app that we can use to document our Salesforce Apex classes. We need to tell ApexDoc where our class files are, and it will generate a set of static HTML pages that fully document each class, including its properties and methods. Each static HTML page will include an expandable menu on its left hand side, that shows a 2-level tree structure of all of our classes. Command line parameters allow us to control many aspects of ApexDoc, such as providing our own banner HTML for the pages to use.

Requirements

  1. For using Apexdoc you need to install java JDK in your system and set its Path in the environment variable.
  2. For using apexdoc you need to install any IDE for salesforce like eclipse, sublime or VS code.

(I will explain the following example using eclipse)

 

Steps to use ApexDoc

  1. Download and install java JDK and set its Path in environment variable.
  2. Download and install eclipse.
  3. Download and Copy apexdoc.jar file to your local machine, somewhere on your path. (All my Source and target folder are in ‘C’ drive so I stored apexdoc.jar in C drive )

You can download apexdoc.jar from this link (https://github.com/SalesforceFoundation/ApexDoc/releases/tag/1.1.7)

  1. Make sure that java is on your path.

 

 

Parameter
Description
-s source_directoryThe folder location which contains your apex .cls classes. Ideally it is the folder ‘classes’ under your Eclipse IDE project setup on disc under “src” subfolder. The best is that you should first copy that classes folder somewhere on disc for example “D:\myproject\classes\”, and use this as source folder.
-t target_directory This is to specify your target folder where documentation will be generated. If not given then it will generates the output documentation into current directory.
-g source_urlA URL where the source is hosted (so ApexDoc can provide links to your source). Optional.
-h home_pageThe full path to an html file that contains the contents for the home page’s content area. Optional.
-a banner_pageThe full path to an html file that contains the content for the banner section of each generated page. Optional.
-p scopeA semicolon separated list of scopes to document. Defaults to ‘global;public;webService’. Optional.

Following are the Command Line Parameters that can be used in ApexDoc

Usage

Make sure that java is on your path. Invoke ApexDoc like this example:

java -jar apexdoc.jar

-s ‘/Users/dhabib/Workspaces/Force.com IDE/Cumulus3/src/classes’

-t ‘/Users/dhabib/Dropbox/Cumulus/ApexDoc’

-p ‘global;public;private;testmethod;webService’

-h ‘/Users/dhabib/Dropbox/Cumulus/ApexDoc/homepage.htm’

-a ‘/Users/dhabib/Dropbox/Cumulus/ApexDoc/projectheader.htm’

-g ‘http://github.com/SalesforceFoundation/Cumulus/blob/dev/src/classes/’

Example command

java -jar apexdoc.jar  -s C:\Users\teamabsyz\eclipseworkspace\forApexdoc3\src\classes -t C:\targetDirectory

Where :

C:\Users\teamabsyz\eclipse-workspace\forApexdoc3\src\classes is the path to my source class

C:\targetDirectory  is the path of my Target Folder which I created to store the documents.

 

Documenting Class Files

ApexDoc scans each class file, and looks for comment blocks with special keywords to identify the documentation to include for a given class, property, or method. The comment blocks must always begin with /** (or additional *’s) and can cover multiple lines. Each line must start with * (or whitespace and then *). The comment block ends with */. Special tokens are called out with @token.

Class Comments

Located in the lines above the class declaration. The special tokens are all optional.

Token
Description
@authorthe author of the class
@datethe date the class was first implemented
@groupa group to display this class under, in the menu hierarchy
@group-contenta relative path to a static html file that provides content about the group
@descriptionone or more lines that provide an overview of the class

 

Property Comments

Located in the lines above a property. The special tokens are all optional.

Token
Description
@descriptionone or more lines that describe the property

 

Method Comments

In order for ApexDoc to identify class methods, the method line must contain an explicit scope (global, public, private, testMethod, webService). The comment block is located in the lines above a method. The special tokens are all optional.

Token
Description
@descriptionone or more lines that provide an overview of the method
@param param namea description of what the parameter does
@returna description of the return value from the method
@exampleExample code usage. This will be wrapped in tags to preserve whitespace

 

ScreenShot Of created Apexdoc

for the following class

class.png

/*************************************************************************     * @description shows the list of All Account

 

Apexdoc.png}

 

 

 

98
Like this post
127 Posts
Team ABSYZ

Search Posts

Archives

Categories

Recent posts

All About The OmniStudio FlexCards

All About The OmniStudio FlexCards

Boost Customer Experience With Repeater Widget in CRM Analytics

Boost Customer Experience With Repeater Widget in CRM Analytics

Enhance Insights Using Custom Tooltips In CRM Analytics

Enhance Insights Using Custom Tooltips In CRM Analytics

Net zero as a Service In CPG Industry

Net zero as a Service In CPG Industry

How Do We Import an External Library into Salesforce Lightning?

How Do We Import an External Library into Salesforce Lightning?

  • Previous PostMaking Callouts with Batch Apex for Data of over 12 MB
  • Next PostTriggering approval process from Napili template

Related Posts

All About The OmniStudio FlexCards
OmniStudio Salesforce

All About The OmniStudio FlexCards

Boost Customer Experience With Repeater Widget in CRM Analytics
CRM Analytics Salesforce

Boost Customer Experience With Repeater Widget in CRM Analytics

Enhance Insights Using Custom Tooltips In CRM Analytics
CRM Analytics Salesforce

Enhance Insights Using Custom Tooltips In CRM Analytics

How Do We Import an External Library into Salesforce Lightning?
Lightning Salesforce

How Do We Import an External Library into Salesforce Lightning?

Leave a Reply (Cancel reply)

Your email address will not be published. Required fields are marked *

*
*

ABSYZ Logo

INDIA | USA | UAE

  • About us
  • Article & Blogs
  • Careers
  • Get In Touch
  • Our Expertise
  • Our Approach
  • Products
  • Industries
  • Clients
  • White Papers

Copyright ©2022 Absyz Inc. All Rights Reserved.

youngsoft
Copy
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “ACCEPT ALL”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent. Privacy Policy
Cookie SettingsREJECT ALLACCEPT ALL
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled

Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.

CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.

Functional

Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.

Performance

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

Analytics

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.

Advertisement

Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.

Others

Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.

SAVE & ACCEPT