Wrapper objects are returned by the AddWrapper
or AddSymmetricWrapper methods of AJS and
AJS_HP. They hold references to the affix objects that are created by these
functions, and also possess four methods, which are simply convenience functions that allow the relevant prefix
and suffix to be treated collectively.
Note that the Wrapper type does not support a
GetExecsRemaining method to compliment the SetExecMax
property. Such a function is possible, but would require AspectJS to define an ExecsRemaining
type, instances of which would be returned by any putative GetExecsRemaining method, and
which would hold appropriate values for the prefix and suffix that constitute the wrapper in question.
The execution maximum for a prefix or suffix could then be retrieved using syntax such as the following:
// Instantiation of MyWrapper not shown
var PrefixExecs = MyWrapper.GetExecsRemaining ().PrefixExecsRemaining;
However, as AspectJS stands, the following syntax yields precisely the same effect:
// Instantiation of MyWrapper not shown
var PrefixExecs = MyWrapper.Prefix.GetExecsRemaining ();
Clearly the first example yields no compelling advantage over the second, therefore the
Wrapper type does not support a GetExecsRemaining method.
wrapper.Prefix
Implementation : Attribute
Description : This attribute corresponds to the prefix object that is created
on a call to AddWrapper or AddSymmetricWrapper.
Type : Reference to a Prefix object.
Notes : See the Affix-type API for the methods exposed by an Affix
object.
wrapper.Suffix
Implementation : Attribute
Description : This attribute corresponds to the suffix object that is created
on a call to AddWrapper or AddSymmetricWrapper.
Type : Reference to a Suffix object.
Notes : See the Affix-type API for the methods exposed by an Affix
object.
wrapper.Promote
Implementation : Function
Description : Promotes both the prefix and suffix that are subsumed by the
wrapper object on which this function is called.
Signature : Promote ()
Parameters : None.
Returns : Boolean.
Throws : Nothing.
Notes : This function returns true only if both the prefix and the
suffix subsumed by the wrapper object could be promoted,
otherwise it returns false.
wrapper.Demote
Implementation : Function
Description : Demotes both the prefix and suffix that are subsumed by the
wrapper object on which this function is called.
Signature : Demote ()
Parameters : None.
Returns : Boolean.
Throws : Nothing.
Notes : This function returns true only if both the prefix and the
suffix subsumed by the wrapper object could be demoted,
otherwise it returns false.
wrapper.Remove
Implementation : Function
Description : Removes both the prefix and suffix that are subsumed by the
wrapper object on which this function is called.
Signature : Remove ()
Parameters : None.
Returns : Wrapper reference.
Throws : Nothing.
Notes :
wrapper.SetExecMax
Implementation : Function
Description : Sets the execution limit for both the prefix and suffix that are
subsumed by the wrapper object on which this function is called.
Signature : SetExecMax (NewMax_Prefix, NewMax_Suffix[, ClientCallPoint])
Parameters : NewMax_Prefix - Integer, denoting the new maximum number of
times that the prefix (that is subsumed by
the wrapper object on which this function is
called) should execute.
NewMax_Suffix - Integer, denoting the new maximum number of
times that the suffix (that is subsumed by
the wrapper object on which this function is
called) 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 : Nothing.
Throws : Error object, if - NewMax_Prefix is undefined
NewMax_Prefix is non-numeric
NewMax_Prefix is less than one
NewMax_Suffix is undefined
NewMax_Suffix is non-numeric
NewMax_Suffix is less than one
Notes : This method does not actually throw any exceptions itself,
therefore any exceptions raised must originate in the SetExecMax
methods that this function calls on the prefix and suffix members
of the host Wrapper-object. Given this, the message member of
any Error object thrown will always state that it comes from the
SetExecMax method of the affix object in question.