Axaptapedia is now maintained by AgileCadence For more information please click here.

Accessor Methods Generator

From Axaptapedia
Jump to: navigation, search

Accessor Methods Generator creates accessor methods for private member variables of Dynamics AX objects. All member variables declared in a selected class are displayed to an user, he or she marks the variables and adjust proposed method properties. Methods are generated immediately after a confirmation.

Accessor Methods Generator

Download

Accessor Methods Generator 0.2

Installation

  1. Import downloaded .xpo file.
  2. Add DevAccessorMethodsGenerator menu item to SysContextMenu menu.
  3. Add the following code to SysContextMenu.verifyItem() (inside case MenuItemType::Action)

<xpp>case menuitemActionStr(DevAccessorMethodsGenerator):

   if (this.selectionCount() == 1
       && !firstNode.AOTIsOld()
       && DevAccessorMethodsGenerator::isSupportedTreeNode(firstNode))
   {
       return 1;
   }
   return 0;</xpp>

Supported AX versions

Accessor Methods Generator v 0.2 supports Dynamics AX 4.0 and Dynamics AX 2009.

Usage

  • Select AOT object with member variables (typically a class, but is can be also a form etc.), open context menu and choose Generate accessor methods.
  • A form is displayed, showing one record for each member variable. Following fields are available:
    • Mark (editable) - Mark it if you want to create an accessor method for this variable.
    • Variable type (read only) - Type of the member variable.
    • Variable (read only) - Name of the member variable.
    • Read (editable) - If marked, generated method will return value of the variable.
    • Write (editable) - If marked, method will accept a parameter and write value to the variable.
    • Method name (editable) - Accessor method name. Can be adjusted by user.
    • Parameter name (editable) - Name of the parameter of the accessor method (if applicable). Can be adjusted by user.
    • Parent (read only) - Checked if the variable is defined in some parent class and not in the selected class itself.
  • Choose variables (filtering can be used in the form), mark them, adjust the setting and click OK.
  • Methods are generated and result is displayed in the Infolog. Methods can be opened by double clicking on the infolog message.

Customizations

There is no parametrization available - modify the source code if needed. For example, if you want to change the default method prefix, adjust the getPrefix() method in the TmpDevAccessorMethod table.