Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save VivekMChawla/f396c0fe5ca38ec741e2 to your computer and use it in GitHub Desktop.
Save VivekMChawla/f396c0fe5ca38ec741e2 to your computer and use it in GitHub Desktop.
Collection of Apex "Comment Header" snippets.

This gist contains multiple files. Each file contains a specific type of Apex or Visualforce comment header.

When code is no longer used, but can not be deleted from your org, add the @deprecated annotation to the File or Method Header.

/**
* ─────────────────────────────────────────────────────────────────────────────────────────────────┐
* One or two sentence summary of this class.
*
* Additional information about this class should be added here, if available. Add a single line
* break between the summary and the additional info. Use as many lines as necessary.
* ──────────────────────────────────────────────────────────────────────────────────────────────────
* @author Vivek M. Chawla <[email protected]>
* @modifiedBy Vivek M. Chawla <[email protected]>
* @maintainedBy Vivek M. Chawla <[email protected]>
* @version 1.0
* @created YYYY-MM-DD
* @modified YYYY-MM-DD
* @systemLayer Invocation | Service | Utility | Selector | Domain | Test
* @see ????
* @see ????
* ──────────────────────────────────────────────────────────────────────────────────────────────────
* @changes
* vX.X [email protected]
* YYYY-MM-DD Explanation of the change. Multiple lines can be used to explain the change, but
* each line should be indented till left aligned with the previous description text.
*
* vX.X [email protected]
* YYYY-MM-DD Each change to this file should be documented by incrementing the version number,
* and adding a new entry to this @changes list. Note that there is a single blank
* line between each @changes entry.
* ─────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
/**
* ─────────────────────────────────────────────────────────────────────────────────────────────────┐
* Apex REST class designed to [Insert Summary Description Here].
*
* [Additional information about this class should be added here, if available. Add a single line
* break between the summary and the additional info.  Use as many lines as necessary. Make sure to
* leave a line break between the class description and the URL Mapping, below.]
*
* URL Mapping: [Insert URL Mapping Here]
*
* HTTP Verbs Handled:
*
* POST - [Insert Functional Description Here]
* GET - [Insert Functional Description Here]
* PUT - [Insert Functional Description Here]
* DELETE - [Insert Functional Description Here]
* PATCH - [Insert Functional Description Here]
*
* ──────────────────────────────────────────────────────────────────────────────────────────────────
* @author Vivek M. Chawla <[email protected]>
* @modifiedBy Vivek M. Chawla <[email protected]>
* @maintainedBy Vivek M. Chawla <[email protected]>
* @version 1.0
* @created YYYY-MM-DD
* @modified YYYY-MM-DD
* @systemLayer Invocation
* @see ????
* @see ????
* ──────────────────────────────────────────────────────────────────────────────────────────────────
* @changes
* vX.X [email protected]
* YYYY-MM-DD Explanation of the change. Multiple lines can be used to explain the change, but
* each line should be indented till left aligned with the previous description text.
*
* vX.X [email protected]
* YYYY-MM-DD Each change to this file should be documented by incrementing the version number,
* and adding a new entry to this @changes list. Note that there is a single blank
* line between each @changes entry.
* ─────────────────────────────────────────────────────────────────────────────────────────────────┘
*/
<!--
* ─────────────────────────────────────────────────────────────────────────────────────────────────┐
* One or two sentence summary of this page or component.
*
* Additional information about this page or component should be added here, if available. Add a
* single line break between the summary and the additional info. Use as many lines as necessary.
* ──────────────────────────────────────────────────────────────────────────────────────────────────
* @author Vivek M. Chawla <[email protected]>
* @modifiedBy Vivek M. Chawla <[email protected]>
* @maintainedBy Vivek M. Chawla <[email protected]>
* @version 1.0
* @created YYYY-MM-DD
* @modified YYYY-MM-DD
* @systemLayer Entrypoint
* @controller None | Standard | MyCustomController.cls
* @controllerex None | MyControllerExtension.cls
* @see ????
* @see ????
* ──────────────────────────────────────────────────────────────────────────────────────────────────
* @changes
* vX.X [email protected]
* YYYY-MM-DD Explanation of the change. Multiple lines can be used to explain the change, but
* each line should be indented till left aligned with the previous description text.
*
* vX.X [email protected]
* YYYY-MM-DD Each change to this file should be documented by incrementing the version number,
* and adding a new entry to this @changes list. Note that there is a single blank
* line between each @changes entry.
* ─────────────────────────────────────────────────────────────────────────────────────────────────┘
-->
/**
* ───────────────────────────────────────────────────────────────────────────────────────────────┐
* One or two sentence description of this Outer Method.
* ────────────────────────────────────────────────────────────────────────────────────────────────
* @param NAME DESCRIPTION (MENTION PARAMETER TYPE IN DESCRIPTION)
* @param NAME DESCRIPTION (MENTION PARAMETER TYPE IN DESCRIPTION)
* @return TYPE DESCRIPTION (MENTION LIKELY VALUES IN DESCRIPTION)
* ───────────────────────────────────────────────────────────────────────────────────────────────┘
*/
/**
* ─────────────────────────────────────────────────────────────────────────────────────────────┐
* One or two sentence description of this Inner Method.
* ──────────────────────────────────────────────────────────────────────────────────────────────
* @param NAME DESCRIPTION (MENTION PARAMETER TYPE IN DESCRIPTION)
* @param NAME DESCRIPTION (MENTION PARAMETER TYPE IN DESCRIPTION)
* @return TYPE DESCRIPTION (MENTION LIKELY VALUES IN DESCRIPTION)
* ─────────────────────────────────────────────────────────────────────────────────────────────┘
*/
/**
* ───────────────────────────────────────────────────────────────────────────────────────────────┐
* Write a single, summary sentence for this test method.
*
* Write additional general information about this test method. Describe the functionality that
* this method is designed to test, including both positive and negative test cases.
*
* While writing this comment, use as many lines as necessary, but keep each line within the 100
* character wide box defined by the top ───┐ and bottom ───┘ brackets.
* ────────────────────────────────────────────────────────────────────────────────────────────────
* Test Method Naming Conventions:
*
* All methods marked by the @testMethod annotation should be named in a manner that describes the
* functional test logic being implemented by using the following pattern:
*
* MethodName_StateUnderTest_ExpectedBehavior
*
* Examples: enrollStudent_InvalidData_ExceptionThrown(), addFollower_ValidData_Success()
* ────────────────────────────────────────────────────────────────────────────────────────────────
* FUNCTIONAL TEST LOGIC
* ────────────────────────────────────────────────────────────────────────────────────────────────
*
* PLEASE FOLLOW THIS LAYOUT EXAMPLE:
*
* 1. Step one.
* A. Sub-step 1-A
* B. Sub-step 1-B
* > Additional details within sub-step 1-B
* 2. Step two.
* A. Sub-step 2-A
* > Additional details within sub-step 2-A
* > ... (process / steps repeat)
* > Final detail within sub-step 2-A
* N. Steps continue until functional logic explanation is complete.
* ───────────────────────────────────────────────────────────────────────────────────────────────┘
*/
/**
* ───────────────────────────────────────────────────────────────────────────────────────────────┐
* If you can't use the ideal template above, just write a quick summary of what is being tested.
* Use the same naming conventions detailed in the example above.
* ───────────────────────────────────────────────────────────────────────────────────────────────┘
*/
/* Inline Comment Decorators (100 / 80 Column Max) - Created by [email protected] */
//─────────────────────────────────────────────────────────────────────────────────────────────────┐
// 100 chars
//─────────────────────────────────────────────────────────────────────────────────────────────────┘
//───────────────────────────────────────────────────────────────────────────────────────────────┐
// 98 chars
//───────────────────────────────────────────────────────────────────────────────────────────────┘
//─────────────────────────────────────────────────────────────────────────────────────────────┐
// 96 chars
//─────────────────────────────────────────────────────────────────────────────────────────────┘
//───────────────────────────────────────────────────────────────────────────────────────────┐
// 94 chars
//───────────────────────────────────────────────────────────────────────────────────────────┘
//─────────────────────────────────────────────────────────────────────────────────────────┐
// 92 chars
//─────────────────────────────────────────────────────────────────────────────────────────┘
//───────────────────────────────────────────────────────────────────────────────────────┐
// 90 chars
//───────────────────────────────────────────────────────────────────────────────────────┘
//─────────────────────────────────────────────────────────────────────────────────────┐
// 88 chars
//─────────────────────────────────────────────────────────────────────────────────────┘
//─────────────────────────────────────────────────────────────────────────────┐
// 80 chars
//─────────────────────────────────────────────────────────────────────────────┘
//───────────────────────────────────────────────────────────────────────────┐
// 78 chars
//───────────────────────────────────────────────────────────────────────────┘
//─────────────────────────────────────────────────────────────────────────┐
// 76 chars
//─────────────────────────────────────────────────────────────────────────┘
//───────────────────────────────────────────────────────────────────────┐
// 74 chars
//───────────────────────────────────────────────────────────────────────┘
//─────────────────────────────────────────────────────────────────────┐
// 72 chars
//─────────────────────────────────────────────────────────────────────┘
//───────────────────────────────────────────────────────────────────┐
// 70 chars
//───────────────────────────────────────────────────────────────────┘
//─────────────────────────────────────────────────────────────────┐
// 68 chars
//─────────────────────────────────────────────────────────────────┘
@SalesPlan
Copy link

Thanks Vivek, very neat and useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment