Skip to content

ApexClassUtilities

pozil edited this page Oct 11, 2021 · 19 revisions

layout: default

ApexClassUtilities class

Contains reusable code dealing with ApexClass objects. This is primarily used by the LWC components for displaying code in an org.

Related

RecipeTreeViewController, FormattedRecipeDisplayController


Methods

getGroupFromClassBody(ApexClass klass)String

Extracts the @group annotation from a class' body. Also demonstrates the use of Regex matchers in Apex.

Parameters

Param Description
klass an ApexClass object

Return

Type

String

Description

String This is the text following '@group' through

Example

ApexClass klass = [SELECT Name, Body FROM ApexClass LIMIT 1];
System.debug(ApexClassUtilities.getGroupBodyFromClassBody(klass));

getRelatedClassesFromClassBody(ApexClass klass)String

Extracts the @see annotation from a class' body. Also demonstrates the use of Regex matchers in Apex.

Parameters

Param Description
klass an ApexClass object

Return

Type

String

Description

String This is the text following '@see' through

Example

ApexClass klass = [SELECT Name, Body FROM ApexClass LIMIT 1];
System.debug(ApexClassUtilities.getRelatedClassesFromClassBody(klass));

Clone this wiki locally