Code Generation

Code Generation in JetForcer

Content:

Introduction

Let JetForcer generate members for you instead of wasting your time on routine typing - just press Alt+Insert and it determines what members can be generated in the current context and suggests them in the Generate pop-up menu.

Generate Constructor

Create constructors in a few seconds with JetForcer - just invoke Generate pop-up menu, select Constructor and choose:

  • Fields that you want to initialize in constructor.

  • Super constructor (if needed).

JetForcer will generate a new constructor with all the options you've chosen.

Override and Implements Methods

Use code generation to implement or override inherited methods - all the available options will be suggested in a list, simply choose methods you want and a stub will be generated for the each selected method.

Generate Test Methods

Test methods can also be generated: place caret in the test class where you want to have a new method, invoke Generate menu and select Test Method.

Generate Server Controller call

JetForcer can also generate a stub call to a server controller in a client controller. To invoke the feature do the following:

  • Open the corresponding client controller in the editor and place the cursor where you want a server controller call to be generated.
  • Press Alt+Insert and select 'Call to server controller from the Generate menu.

  • Choose desired server method.

  • Edit generated tempalte.

Create from Usage

Sometimes while coding you want to use an entity, that isn't declared yet - for that case we have another time-saving feature: Create from Usage... quick-fixes group.

To create a new entity from their usage just type the name of the entity and JetForcer will suggest a quick-fix, that generates it. It can be a class, a field or a property, a method, a local variable - JetForcer will suggest you all the appropriate in the context options.

Moreover, it will detect the type, and in case it's a method that would be not only the return type but also types of its parameters.

Configuring Code Generation Options

Code Generation is a flexibly configurable feature - you can choose a naming style for different entities, default visibility or members order. The full list of what can be customized you can find in File | Settings | Editor | Code Style | Apex | Code Generation.