Difference between revisions of "Add a Class"
From LongJump Support Wiki
imported>Aeric m (Text replace - 'Setup > Develop > ' to 'Designer > Logic > ') |
imported>Aeric m (Text replace - 'Designer > Logic >' to 'Designer >') |
||
(10 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
'''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: | 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 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.) | :* 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 | :* Classes in the same package can access each others package-protected fields and methods, as well as their public members, without doing an <tt>import</tt>. 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 <tt>import</tt> declaration. | :* Classes that are part of a different package can be accessed with an <tt>import</tt> declaration. | ||
'''To add a class:''' | |||
# Click '''Designer > Classes''' | |||
# Click '''Designer | |||
# Click '''[New Class]''' | # Click '''[New Class]''' | ||
# Fill in the class properties. | # Fill in the class properties. | ||
# Click '''[Save | # Click '''[Next]'''<br>A class template appears. | ||
# Provide the code for the class. | |||
# Click '''[Save]''' | |||
====Class properties==== | ====Class properties==== | ||
:;Package:The package name | :;Package:The package name | ||
::*The platform supplies this part: <tt>com.platform.{namespace}</tt>, where {namespace} is defined in the [[ | ::*The platform supplies this part: <tt>com.platform.{namespace}</tt>,<br> where {namespace} is defined in the [[Developer Configuration]] settings of the current tenancy. | ||
::*You supply this part: <tt>{packagename}</tt> | ::*You supply this part: <tt>{packagename}</tt> | ||
::: The result is the fully-qualified package path for the class: <tt>com.platform.{namespace}.{packagename}</tt> | ::: The result is the fully-qualified package path for the class: <tt>com.platform.{namespace}.{packagename}</tt> | ||
:;Class Name:The name of the class | :;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 (_). | ||
{{ # | {{ #if: {{ShowIsvInfo}} | ||
|:;Global Class:Checkbox | |:;Global Class:Checkbox | ||
:::If checked, this class is a [[Classes#Global Classes|Global Class]] | :::If checked, this class is a [[Classes#Global Classes|Global Class]] | ||
:::If unchecked, this class is available to users in the current tenancy, only}} | :::If unchecked, this class is available to users in the current tenancy, only}} | ||
:;Java code: Enter Java code in the text area. | :;Java code: Enter Java code in the text area. |
Latest revision as of 23:38, 22 June 2012
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:
- Click Designer > Classes
- Click [New Class]
- Fill in the class properties.
- Click [Next]
A class template appears. - Provide the code for the class.
- 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}
- The platform supplies this part: com.platform.{namespace},
- 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
- If checked, this class is a Global Class
- If unchecked, this class is available to users in the current tenancy, only
- Java code
- Enter Java code in the text area.