Create the coverable adapter

Before you begin

Declare coverable adapter in coverable entity

About this task

After you declare the coverable adapter, you must write the code for the adapter. Auto-complete in Studio helps you write the code. Create coverable adapters for each coverable object. For Golf Cart, create coverable adapters for GolfCartLine and GOCart.

Procedure

  1. In the Project window in Studio, navigate in configuration > gsrc to the gw.lob.line package.
    For Golf Cart, navigate to gw.lob.go.
  2. Right-click the line node, and then select New > Gosu Class.
  3. Enter the name of the adapter. You specified the name of the adapter in the implementsEntity element.
    For the GolfCartLine entity, the name of the coverable adapter is GolfCartLineCoverableAdapter.
  4. In the new Gosu class, write a constructor for the coverable adapter.
    For Golf Cart, the code for the GolfCartLineCoverableAdapter is:
    package gw.lob.go
    uses gw.api.domain.CoverableAdapter
    uses entity.GolfCartLine
    class GolfCartLineCoverableAdapter implements CoverableAdapter
    {
      var _owner : entity.GolfCartLine
      construct(owner : entity.GolfCartLine)
      {
        _owner = owner
      }
    }
    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 CoverableAdapter) 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 coverable adapters for other lines of business as an example.
  7. Repeat for other coverables.