ABSYZ ABSYZ

  • Home

    Welcome to ABSYZ

  • 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

Apex Documentation Using ApexDoc

By arunimaathghara 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_directory The 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_url A URL where the source is hosted (so ApexDoc can provide links to your source). Optional.
-h home_page The full path to an html file that contains the contents for the home page’s content area. Optional.
-a banner_page The full path to an html file that contains the content for the banner section of each generated page. Optional.
-p scope A 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
@author the author of the class
@date the date the class was first implemented
@group a group to display this class under, in the menu hierarchy
@group-content a relative path to a static html file that provides content about the group
@description one 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
@description one 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
@description one or more lines that provide an overview of the method
@param param name a description of what the parameter does
@return a description of the return value from the method
@example Example 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}

 

 

 

34
Like this post
1 Post
arunimaathghara

Search Posts

Archives

Categories

Recent posts

Top 5 Factors to evaluate before choosing a Salesforce Integrator

Top 5 Factors to evaluate before choosing a Salesforce Integrator

Significance of UI/UX Design

Significance of UI/UX Design

Cyber-security in an uncertain world

Cyber-security in an uncertain world

The world of AR and VR

The world of AR and VR

The in-and-out of ML

The in-and-out of ML

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

Related Posts

Cyber-security in an uncertain world
Apex

Cyber-security in an uncertain world

REST API call from Einstein Analytics Dashboard
Apex REST Salesforce Salesforce Einstein Wave Analytics

REST API call from Einstein Analytics Dashboard

Create/Update Salesforce Picklist definitions using metadata API
Integration Metadata API Salesforce

Create/Update Salesforce Picklist definitions using metadata API

Leave a Reply (Cancel reply)

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

*
*

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

ABSYZ Software Consulting Pvt. Ltd.
USA: 49197 Wixom Tech Dr, Wixom, MI 48393, USA
M: +1.415.364.8055

India: 6th Floor, SS Techpark, PSR Prime, DLF Cyber City, Gachibowli, Hyderabad, Telangana – 500032
M: +91 79979 66174

Copyright ©2020 Absyz Inc. All Rights Reserved.

youngsoft
Copy