Create the coverage adapter

Before you begin

Declare coverage adapter in coverage entity

About this task

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

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 GolfCartLineCov entity, the name of the coverable adapter is GolfCartLineCovCoverageAdapter.
  4. In the new Gosu class, write a constructor for the coverable adapter.
    The following is code for the GolfCartLineCovCoverageAdapter. The constructor extends rather than implements the class because it is a subclass of CoverageAdapterBase, which add methods to CoverageAdapter.
    package gw.lob.go
    uses gw.coverage.CoverageAdapterBase
    uses entity.GolfCartLineCov
    
     class GolfCartLineCovCoverageAdapter extends CoverageAdapterBase
    {
      var _owner : entity.GolfCartLineCov
      
      construct(owner : entity.GolfCartLineCov)
      {
        super(owner)
        _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 CoverageAdapterBase) 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. Use the coverage adapters for other lines of business, such as businessowners, as an example.
  7. At this point, you can verify your work. For instructions, see Verify your work.