Overview

A function of the generated struct class is the ability to automatically assign values between matching fields in another struct as provided by the generated struct class's super class curam.util.type.struct.Struct. Consider an example of a struct, BankBranchStruct with several attributes:

A BankBranchListDetails struct class has a subset of attributes shared with the BankBranchStruct class:

Based on this example modeling the following Java code illustrates how to create these objects.

BankBranchStruct bankBranchStruct
  = new BankBranchStruct();
BankBranchListDetails bankBranchListDetails
  = new BankBranchListDetails();

Typically, the assignment from one struct to the other might look like this:

bankBranchListDetails.bankBranchID
        = bankBranchStruct.bankBranchID;
bankBranchListDetails.bankSortCode
        = bankBranchStruct.bankSortCode;
bankBranchListDetails.name = bankBranchStruct.name;

The above code can be simplified as follows using the assign function, which becomes more significant as the size of the structs increases:

bankBranchListDetails.assign(bankBranchStruct);

An assignable relationship then is one which allows further control of the specifics of the automatic assignment with the assign function. It is required where you want to do explicit field assignment between fields with differing names or to suppress the default assignment between fields of the same name.