2017 June Release

Defining proprietary types and property classesPermanent link for this heading

In some rare cases it is necessary to define special type instances. This is done by creating an instance of a type class. Properties using this type can be declared by using a special syntax, specifying the property class and the new type.

It is even possible to declare a special property class to be able to specifiy new property attributes. This class has to be a subclass of an existing property class.

The software component NUMERATOR@1.1001 uses this method to define special property types for key numerators. See the sample code how to use these.

Note: Using proprietary types and property definition classes might result in unexpected behavior of the generic UI controls, so the general advice is not to use this feature unless you are really familiar with the existing object model.

Example

objmodel APPDUCXSAMPLE@200.200
{
  import COOSYSTEM@1.1;

  import NUMERATOR@1.1001;

  

  /*

   * new type to be used in this project

   */

  instance TypeStringDef ZIPCODE {

  }

  /*

   * property definition class for properties of new type

   */

  class AttributeZipcodeDef : AttributeStringDef {

    programmatic = true;

    attrinitobjs<attrobjmember, attrinitobjval> = {

      { attrtype, ZIPCODE }

    }

    boolean digitsonly;

  }

  /*

   * class using the new property and type definitions

   */

  class Location {

    AttributeStringDef<ZIPCODE> anyzipcode;

    AttributeZipcodeDef<ZIPCODE> germanzipcode {

      digitsonly = true;

    }

    KeyNumerator<INTEGER> locnumber {

      keyentrylist<NUMERATOR@1.001:objclass, keyattrlist> = {

        { Location, objowner }

      }

    }

  }

}