Difference between revisions of "Add a Class"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
Line 22: Line 22:
:;Class Name:The name of the class. Must consist of alphanumeric characters (a-z,A-Z,0-9) or underscores (_). Must start with an alphabetic character (a-z,A-Z) or underscore (_).
:;Class Name:The name of the class. Must consist of alphanumeric characters (a-z,A-Z,0-9) or underscores (_). Must start with an alphabetic character (a-z,A-Z) or underscore (_).


<!--
:;Global Class:Checkbox
:;Global Class:Checkbox
:::This option is available only in the [[Installable Version]].
:::This option is available only in the [[Installable Version]].
:::If checked, the class is a [[Classes#Global Classes|Global Class]].
:::If checked, the class is a [[Classes#Global Classes|Global Class]].
:::If unchecked, the class is available only in the current tenant.
:::If unchecked, the class is available only in the current tenant.
-->


:;Java code: Enter Java code in the text area.
:;Java code: Enter Java code in the text area.

Revision as of 05:06, 9 July 2021

Prerequisite Before you create a class, you need to decide what package to put it in. Here are a few notes to help you make that decision:

  • Packages let you organize classes into different directories according to their functionality, their usability, or any other category that makes sense. (The only rule is that classes in one package have a qualitatively different kind of functionality compared with those in another package.)
  • Packages help to avoid class name collision. (The same class name can be used in different packages.)
  • Classes in the same package can access each others package-protected fields and methods, as well as their public members, without doing an import. So classes that cooperate with each other extensively generally belong in the same package.
  • Classes that are part of a different package can be accessed with an import declaration.

To add a class:

  1. Click GearIcon.png > Customization > Developer Resources > Classes
  2. Click [New Class]
  3. Fill in the class properties.
  4. Click [Next]
    A class template appears.
  5. Provide the code for the class.
  6. Click [Save]

Class properties

Package
The package name
  • The platform supplies this part: com.platform.{namespace},
    where {namespace} is defined in the Developer Configuration settings of the current tenancy.
  • You supply this part: {packagename}
The result is the fully-qualified package path for the class: com.platform.{namespace}.{packagename}
Class Name
The name of the class. Must consist of alphanumeric characters (a-z,A-Z,0-9) or underscores (_). Must start with an alphabetic character (a-z,A-Z) or underscore (_).


Java code
Enter Java code in the text area.