CLASS Verb
Syntax
CLASS accesslevel {STATIC} classname {EXTENDS classname} {IMPLEMENTS interfacelist}
Description
In BBj 6.0 and higher, the CLASS verb marks the beginning of a Custom Object class definition, which must end with a CLASSEND verb.
Parameter |
Description |
---|---|
accesslevel |
The class access level must be specified, and must be either PUBLIC, PRIVATE, or PROTECTED. A PRIVATE class is only visible to code within the same physical file. A PUBLIC class can be accessed from code in other files. A PROTECTED class (BBj 21.0 and higher) can only be accessed from programs within the same directory as the class or interface declaration. |
STATIC | The optional STATIC clause indicates that the class or interface definition should be shared between interpreters using the same SSCP. All custom object dependencies of a STATIC class or interface also need to be STATIC. As part of this, static fields of the class will be shared between the interpreters. |
classname |
The class name must begin with a letter or underscore and can contain any combination of letters, numbers and underscores. |
EXTENDS classname |
The optional EXTENDS clause indicates that this class incorporates the methods of another specified Custom Object class. The classname can be:
|
IMPLEMENTS interfacelist |
The optional IMPLEMENTS clause indicates that this class implements the method signatures of one or more comma-delimited Custom Object interfaces. Each of these interfaces can be:
|
Notes
All BBj Custom Object names (interface name, class name, method name, field name) are case-sensitive.
The CLASS verb must be the only statement on the line (with one exception: it can end with a ; REM comment).
The CLASS verb is a syntax error unless the program also contains a CLASSEND verb on a subsequent line.
The CLASS verb may not be nested within any other CLASS, METHOD, or INTERFACE.
The class definition (the area between CLASS and CLASSEND) can contain fields and methods. Any other statements or labels contained within the class definition but not contained within a method definition are unreachable and will not be executed.
A class can implement one or more Interfaces but cannot extend an Interface.
Since STATIC classes or interfaces are shared by multiple interpreters, starting a new interpreter will not allow you to load a new version of the class or interface if it is changed on disk, assuming that the old version was previously successfully loaded. You may need to restart BBjServices in order to get a new version.
Example
|