API: Affix Type
An Affix object represents a given prefix or suffix that has been applied to a given interceptee.
An Affix object is returned by a call to AddPrefix and AddSuffix. AddWrapper and AddSymmetricWrapper also return Affix objects in pairs, contained within a Wrapper object. An Affix object is also returned by the AddBefore and AddAfter methods that the Affix type itself supports.
The Affix type supports other methods that are not documented here. On NO account should client code call these methods, as doing so may corrupt the interception mechanism that is associated with a given interceptee.
Contents
affix.GetPrev
Implementation : Function

Description    : Returns the previous sibling of the affix upon which this
                 function is called.

Signature      : GetPrev ()

Parameters     : None.

Throws         : Nothing.

Returns        : Affix reference, representing the next affix object in the
                 interception set.

Notes          : Calling this method on the first in a set of affixes returns a
                 reference to the object on which the method was called. This
                 prevents client iterators from passing to a point
                 before the beginning of a set of prefixes or suffixes.
affix.GetNext
Implementation : Function

Description    : Returns the next sibling of the affix object upon which this
                 function is called.

Signature      : GetNext ()

Parameters     : None.

Returns        : Affix reference.

Throws         : Nothing.

Notes          : Calling this method on the last in a set of affixes returns a
                 reference to the object on which the method was called. This
                 prevents client iterators from passing to a point
                 beyond the end of a set of prefixes or suffixes.
affix.AddBefore
Implementation : Function

Description    : When called on a prefix object (the 'insertee'), this method
                 creates and inserts a new prefix (the 'inserted'), such that the
                 inserted executes before the insertee when the associated
                 interceptee is called.

                 When called on a suffix object, this method creates and inserts a
                 new suffix, such that the inserted executes before the insertee
                 when a call to the associated interceptee is made.

Signature      : AddBefore (Func[, Arg[, ExecMax[, ClientCallPoint]]])

Parameters     : Func             - Reference to the prefix/suffix function that
                                    is to be executed before/after the
                                    interceptee.

                 Arg              - Optional parameter, passed to the
                                    prefix/suffix function when it is executed.
                                    Can be of any type, and any value, and can be
                                    null.

                 ExecMax          - Optional integer, denoting the number of times
                                    the prefix/suffix will execute before it is
                                    removed automatically. A null or non-existent
                                    value for this parameter will cause the
                                    prefix/suffix to execute for every execution
                                    of the interceptee, unless it is removed
                                    explicitly. Any value provided must be greater
                                    than 0.

                 ClientCallPoint  - Optional string, useful in debugging
                                    client-code, and which is incorporated into
                                    the contents of the message member of the
                                    JavaScript Error-objects that AspectJS
                                    methods can throw. Can have any value but,
                                    ideally, should denote the point in the
                                    application's code where the call to
                                    AddBefore was made.

Returns        : Affix reference.

Throws         : Error object, if - 'this' does not refer to the Affix object of which it is a member

                                    Func is undefined
                                    Func is null
                                    Func does not refer to a function

                                    ExecMax is non-numeric
                                    ExecMax is less than 1

Notes          : Although the names of the arguments differ slightly from those
                 passed to AddPrefix and AddSuffix, they are an exact subset of
                 those functions' arguments.

                 A value must be provided for ExecMax if a value for
                 ClientCallPoint is supplied. If the prefix/suffix must remain
                 attached to the interceptee indefinitely then the caller should
                 pass either the Infinity member of the Global object, or the
                 POSITIVE_INFINITY member of the Number type.

                 Calling this method on an Affix object returned by AJS_HP
                 methods has no effect.
affix.AddAfter
Implementation : Function

Description    : When called on a prefix object (the insertee), this method inserts
                 a new prefix (the inserted), such that the inserted executes
                 after the insertee when the associated interceptee is called.

                 When called on a suffix object (the insertee), this method inserts
                 a new suffix (the inserted), such that the inserted executes
                 after the insertee when the associated interceptee is called.

Signature      : AddAfter (Func[, Arg [, ExecMax [, ClientCallPoint]]])

Parameters     : Func             - Reference to the prefix/suffix function that
                                    is to be executed before/after the
                                    interceptee.

                 Arg              - Optional parameter, passed to the
                                    prefix/suffix function when it is executed.
                                    Can be of any type, and any value, and can be
                                    null.

                 ExecMax          - Optional integer, denoting the number of times
                                    the prefix/suffix will execute before it is
                                    removed automatically. A null or non-existent
                                    value for this parameter will cause the
                                    prefix/suffix to execute for every execution
                                    of the interceptee, unless it is removed
                                    explicitly. Any value provided must be greater
                                    than 0.

                 ClientCallPoint  - Optional string, useful in debugging
                                    client-code, and which is incorporated into
                                    the contents of the message member of the
                                    JavaScript Error-objects that AspectJS
                                    methods can throw. Can have any value but,
                                    ideally, should denote the point in the
                                    application's code where the call to
                                    AddAfter was made.

Returns        : Affix reference.

Throws         : Error object, if - 'this' does not refer to the Affix object of which it is a member

                                    Func is undefined
                                    Func is null
                                    Func does not refer to a function

                                    ExecMax is non-numeric
                                    ExecMax is less than 1

Notes          : Although the names of the arguments differ slightly from those
                 passed to AddPrefix and AddSuffix, they are an exact subset of
                 those functions' arguments.

                 A value must be provided for ExecMax if a value for
                 ClientCallPoint is supplied. If the prefix/suffix must remain
                 attached to the interceptee indefinitely then the caller should
                 pass either the Infinity member of the Global object, or the
                 POSITIVE_INFINITY member of the Number type.

                 Calling this method on an Affix object returned by AJS_HP
                 methods has no effect.
affix.Promote
Implementation : Function

Description    : Changes the point in the execution order of a set of affixes
                 at which the corresponding affix function is invoked. Where
                 the affix object is a prefix, execution of the prefix function
                 will antecede the prefix whose exection it previously preceded.
                 If the affix object corresponds to a suffix function,
                 that function's execution will precede the suffix whose
                 execution it previously anteceded.

Signature      : Promote ()

Parameters     : None.

Returns        : Boolean.

Throws         : Nothing.

Notes          : This returns true if the affix was promoted, and returns false
                 if it was not.

                 This function has no effect if there is no affix over
                 which the affix in question can be promoted.
affix.Demote
Implementation : Function

Description    : Changes the point in the execution order of a set of affixes
                 at which the corresponding affix function is invoked. Where
                 the affix object is a prefix, execution of the prefix function
                 will precede the prefix whose exection it previously anteceded.
                 If the affix object corresponds to a suffix function,
                 that function's execution will antecede the suffix whose
                 execution it previously preceded.

Signature      : Demote ()

Parameters     : None.

Returns        : Boolean.

Throws         : Nothing.

Notes          : This returns true if the affix was promoted, and returns false
                 if it was not.

                 This function has no effect if there is no affix over
                 which the affix in question can be promoted.
affix.Remove
Implementation : Function

Description    : Dissociates an affix object from its interceptee.

Signature      : Remove ()

Parameters     : None.

Returns        : Nothing.

Throws         : Error object, if 'this' does not refer to the Affix object of which it is a member

Notes          : When all prefixes and suffixes have been removed (explicitly or
                 implicitly), the interception mechanism is dissociated from the
                 interceptee, all storage it occupies is recovered by the
                 interpreter's garbage collector, and the relationship between
                 the interceptee and its parent object is returned to normal.

                 Calling this function on an affix that has already been removed
                 has no effect, although it does cause the NullFuncCount
                 attribute of the AJS object to be incremented. Similarly, all
                 the other methods available either do nothing, return null, or
                 return zero.

                 It is safe for prefix and suffix functions to call this function
                 themselves. This allows them to dissociate themselves from the
                 interceptee.
affix.GetExecsRemaining
Implementation : Function

Description    : Returns the number of times that the prefix, or suffix, on which
                 this is called will execute before it expires.

Signature      : GetExecsRemaining ()

Parameters     : None.

Returns        : Integer.

Throws         : Nothing.

Notes          : 
affix.SetExecMax
Implementation : Function

Description    : Sets the maximum number of times that a prefix or suffix function
                 will execute before it is detached automatically.

Signature      : SetExecMax (NewMax[, ClientCallPoint])

Parameters     : NewMax           - Integer, denoting the new maximum number of
                                    times the prefix/suffix should execute.

                 ClientCallPoint  - Optional string, useful in debugging
                                    client-code, and which is incorporated into
                                    the contents of the message member of the
                                    JavaScript Error-objects that AspectJS
                                    methods can throw. Can have any value but,
                                    ideally, should denote the point in the
                                    application's code where the call to
                                    SetExecMax was made.

Returns        : Integer.

Throws         : Error object, if - NewMax is undefined
                                    NewMax is non-numeric
                                    NewMax is less than 1

Notes          : The integer returned from this function contains the old
                 ExecMax value.

                 Pass either the Infinity member of the Global object, or the
                 POSITIVE_INFINITY member of the Number type to cause the prefix
                 or suffix to execute an indefinite number of times.
Copyright © Dodeca Technologies Ltd. 2007