API: Affix-Function Signatures
By definition, prefix and suffix functions are not supplied by AspectJS, but are nominated by client code in calls to AddPrefix, AddSuffix, AddWrapper and AddSymmetricWrapper as methods that execute prior to or after the execution of a given interceptee.
Affix functions are free to do whatever they wish. The only consideration is that all exceptions thrown by such methods are absorbed by the interception mechanism that AspectJS implements for a given interceptee. In other words, a call to an intercepted function will execute a particular prefix or suffix, but the interceptee's caller will remain entirely oblivious of any exceptions thrown by that affix.
Contents
user_defined.prefix
Implementation : Function

Description    : Prefix functions are defined and implemented solely by users
                 of AspectJS. They are called before invocation of the
                 interceptee to which they are attached.

Signature      : user-defined ([Arg[, PrevPrefixResult[, IntercepteeArgs]]])

Parameters     : Arg               - The argument passed to the call to the
                                     AddPrefix, AddWrapper, AddSymmetricWrapper
                                     methods of the relevant AspectJS object, or
                                     that passed in a call to AddBefore or
                                     AddAfter of the Affix type. If no
                                     argument is passed to these methods then
                                     the value of this argument, on invocation
                                     of the prefix function, will be undefined.

                 PrevPrefixResult  - The return value from the call to the
                                     previous prefix (if one exists for the
                                     interceptee in question). If no value was
                                     returned this argument has the value of
                                     undefined.

                 IntercepteeArgs   - The arguments passed by the interceptee
                                     caller to the interceptee. Passed as an
                                     'arguments' array.

Returns        : Prefix functions can return any type, of any value.

Throws         : Prefix functions may throw exceptions, although this is
                 redundant, as they are caught and disposed of by the
                 interception mechanism.

Notes          : Prefix-function signatures differ from suffix-function
                 signatures in that they are NOT passed the result of the call
                 to the interceptee because the interceptee (obviously) has not
                 been called by the time the prefix function is called.

                 For prefixes that have been applied using AJS_HP, the value of
                 the PrevPrefixResult argument is always undefined.
user_defined.suffix
Implementation : Function

Description    : Suffix functions are defined and implemented solely by users
                 of AspectJS. They are called following execution of the
                 interceptee to which they are attached.

Signature      : user-defined ([Arg[, PrevSuffixResult[, IntercepteeArgs[, IntercepteeResult]]]])

Parameters     : Arg               - The argument passed to the call to the
                                     AddSuffix, AddWrapper, AddSymmetricWrapper
                                     methods of the relevant AspectJS object, or
                                     that passed in a call to AddBefore or
                                     AddAfter of the Affix type. If no
                                     argument is passed to these methods then
                                     the value of this argument, on invocation
                                     of the suffix function, will be undefined.

                 PrevSuffixResult  - The return value from the call to the
                                     previous suffix (if one exists for the
                                     interceptee in question). If no value was
                                     returned this argument has the value of
                                     undefined.

                 IntercepteeArgs   - The arguments passed by the interceptee
                                     caller to the interceptee. Passed as an
                                     'arguments' array.

                 IntercepteeResult - The value that was returned by the call
                                     to the interceptee. If no value was
                                     returned this will be undefined.

Returns        : Suffix functions can return any type, of any value.

Throws         : Suffix functions may throw exceptions, although this is
                 pointless as they are caught and disposed of by the
                 interception mechanism.

Notes          : Suffix-function signatures differ from prefix-function
                 signatures in that they ARE passed the result of the call to
                 the interceptee because the interceptee has already been
                 called by the time the suffix function is called. This gives
                 suffixes an opportunity to examine both what was passed into
                 the interceptee, and what came out.

                 For suffixes that have been applied using AJS_HP, the value of
                 the PrevSuffixResult argument is always undefined.
Copyright © Dodeca Technologies Ltd. 2007