    [NAME]
    ALL.dao.class.decorator

    [TITLE]
    Class Decorator

    [DESCRIPTION]

    Class decorators are classes (prefixed with @) that can be used modify other classes.
    The modification is done by using such class as a mixin base class to inject (combine)
    its members into the modified class, and by automatically applying its method decorators
    the methods of the modified class.

    For such auto decorator application, only decorators with explicitly specified decoration
    targets are automatically applied. Such targets are expressed as prefix and suffix rules
    which can be expressed in the following ways:
      *  Prefix~ : a prefix pattern.
         The decorator will be auto applied to methods that have names with such prefix;
      *  ~Suffix : a suffix pattern.
         The decorator will be auto applied to methods that have names with such suffix;
      *  Prefix~Suffix : a prefix and suffix pattern.
         The decorator will be auto applied to methods that have names with such prefix and
         suffix;
      *  ~ : an empty prefix and suffix pattern.
         The decorator will be auto applied to any methods.

    When multiple mixin bases are used in a host class, the decorators of the first mixin
    base are applied the last. An the first decorator of the same decorator is also applied
    the last as well.

       1  class @Header
       2  {
       3      static routine @Delimiter( meth(args) : routine ) for ~ {
       4          io.writeln( '=======================' )
       5          return meth( args, ... )
       6      }
       7      routine @Delimiter( meth(args) : routine ) for ~ {
       8          io.writeln( '-----------------------' )
       9          return meth( args, ... )
      10      }
      11  }
      12  class @Decorator
      13  {
      14      var value = 654321
      15
      16      routine @Test( meth(args) : routine<self:@Decorator> ) for Test {
      17          io.writeln( 'Decorator::Test()', value )
      18          meth( args, ... );
      19      }
      20      routine @Prefix( meth(args) : routine<self:@Decorator> ) for Prefix~ {
      21          io.writeln( 'Decorator::Prefix()' )
      22          meth( args, ... );
      23      }
      24      routine @Suffix( meth(args) : routine<self:@Decorator> ) for ~Suffix {
      25          io.writeln( 'Decorator::Suffix()' )
      26          meth( args, ... );
      27      }
      28      routine @Prefix_Suffix( meth(args) : routine<self:@Decorator> ) for Prefix~Suffix {
      29          io.writeln( 'Decorator::Prefix_Suffix()' )
      30          meth( args, ... );
      31      }
      32  }
      33
      34  class MyMixin ( @Header, @Decorator )
      35  {
      36      routine Test(){
      37          io.writeln( 'MyMixin::Test()' )
      38      }
      39      routine PrefixTest(){
      40          io.writeln( 'MyMixin::PrefixTest()' )
      41      }
      42      routine TestSuffix(){
      43          io.writeln( 'MyMixin::TestSuffix()' )
      44      }
      45      routine PrefixTestSuffix(){
      46          io.writeln( 'MyMixin::PrefixTestSuffix()' )
      47      }
      48  }
      49
      50  obj = MyMixin()
      51  obj.Test()
      52  obj.PrefixTest()
      53  obj.TestSuffix()
      54  obj.PrefixTestSuffix()