Create the modifier adapter

Before you begin

Declare modifier adapter on the modifier entity

About this task

After you declare the modifier adapter for the new line of business, you must write the code for the adapter. Auto-complete in Studio helps you write the code. Create modifier adapters for each modifier. The process is similar to creating the Coverable adapter.

Procedure

  1. In the Project window in Studio, navigate in configuration > gsrc to gw.lob.line.
    For Golf Cart, navigate to gw.lob.go.
  2. Right-click the line, and select New > Gosu Class.
  3. Enter the name of the adapter. You specified the name of the adapter in the implementsEntity element of the modifier.
    For Golf Cart, enter GOModifierAdapter.
  4. In the new Gosu class, write a constructor similar to the following for the GOModifierAdapter. The class implements ModifierAdapter:
    package gw.lob.go
    uses gw.api.domain.ModifierAdapter
     
    class GOModifierAdapter implements ModifierAdapter {
     
      var _owner : entity.GOModifier
     
      construct(modifier : GOModifier) {
        _owner = modifier
      }
    }
    This code produces a Gosu error in the class statement that you fix in the next step.
  5. Place the insertion point at the error (after ModifierAdapter) and press Alt-Enter. Click the ImplementMethods command that pops up to open the Select Methods to Implement dialog box. With all listed methods selected, click OK to insert the empty methods into your code.
  6. Write code for the new methods and properties. In most cases, the code for each method is a single line. Examine the modifier adapters for other lines of business as an example.
    Note: Some of these methods apply to rate factors. Add the code for these methods after you define rate factors in Creating rate factors.
  7. At this point, you can verify your work. For instructions, see Verify your work.