IBM Support

How do I declare a class as abstract or final in Rhapsody in J?

Question & Answer


Question

How do I declare a class as abstract or final in Rhapsody in J?

Answer

Rhapsody does not support abstract or final classes directly. However it is possible to declare a class as abstract or final by
using the JAVA_CG::Class SpecificationProlog property. Modify this property for a class foo as follows:
 
abstract class foo {
//
 
It is important to not hit a carriage return after the //. This will comment out the generated declaration of the class and use what
you have in this property. You will also need to create a constructor for the abstract class and then set the property CG::Generate
to false. This prevents generation of the constructor for the abstract class. You can also use the same technique to generate a final class.
308 AnswerProduct versionPartner ContentInternal ContentCategoryReference IDAuthor

[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Historical Number

10234

Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022

UID

swg21323561