Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
@OperationDefault(
    operation: 'stage',
    defaultValue: {
      a: 'be'
    }
)
class test
{}

...

Every stage operation would have a: 'be' implicitly added to it's arguments.  This can be verified in the log.

...

Code Block
@OperationDefault(
    operation: 'stage',
     defaultValue: {
      a: 'b'
     }
)
@OperationDefault(
    operation: 'stage',
     defaultValue: {
       b: 'c'
     }
)@Test
testSome()
{
	stage();
	stage(b: 'd');
}
 
@Test
testOther()
{
	stage();
}

The first stage operation in testSome would have arguments {a:'b', b: 'c'}, whereas the second would have {a: 'b', b: 'd'}.   The stage operation in testOther would simply have {a: 'e'} - inherited from the class.

Matching

There are two additional, rather confusing attributes named matchWhen and doNotMatchWhen.  These are both arrays of strings, both may be supplied.  For matchWhen, in the context of the above example, you could supply ['c'] as the match list, and the default would only be applied to an operation named 'stage', but also containing an attribute 'c'.  doNotMatchWhen works the opposite of matchWhen - it excludes what it matches.  The purpose of matching is to select only of a set of polymorphic operations.  E.G., you want to match file assertions (matchWhen: ['source-file']) but not database assertions (doNotMatchWhen: 'source-table']).

...