Mixin Method Builder
Method Annotations vs. Parameter Annotations
The following methods build out annotations that apply to the method being built:
methodBuilder:inject()methodBuilder:modifyArg()methodBuilder:modifyArgs()methodBuilder:modifyExpressionValue()methodBuilder:modifyReturnValue()methodBuilder:wrapMethod()methodBuilder:custom()methodBuilder:expression()methodBuilder:definition()
Most of these functions represent injector annotations. Only one injector annotation can be provided per-method. The exceptions to this are expression() and definition(), which can be provided more than once per method.
The following methods build out sugar annotations that apply to parameters that are appended to the end of the parameter list of the method being built:
methodBuilder:localref()methodBuilder:share()methodBuilder:cancellable()
methodBuilder:inject(annotation)
Creates an @Inject annotation.
For more information see:
- Mixin Wiki - Advanced Mixin Usage - Callback Injectors
- Mixin Cheatsheet -
@Inject - Mixin Cheatsheet -
@Inject, cancellable
Parameters
annotation-table: An annotation table that matches the@Injectannotation.
Returns
userdata [instance]: The mixin method builder this annotation is being applied to.
methodBuilder:modifyArg(annotation, targetType)
Creates a @ModifyArg annotation.
For more information see Mixin Cheatsheet - @ModifyArg.
Parameters
annotation-table: An annotation table that matches the@ModifyArgannotation.targetType-string: A type descriptor string of the argument being modified.
Returns
userdata [instance]: The mixin method builder this annotation is being applied to.
methodBuilder:modifyArgs(annotation)
Creates a @ModifyArgs annotation.
For more information see Mixin Cheatsheet - @ModifyArgs.
Parameters
annotation-table: An annotation table that matches the@ModifyArgsannotation.
Returns
userdata [instance]: The mixin method builder this annotation is being applied to.
methodBuilder:modifyExpressionValue(annotation, targetType)
Creates a @ModifyExpressionValue annotation.
For more information see MixinExtras - ModifyExpressionValue
Parameters
annotation-table: An annotation table that matches the@ModifyExpressionValueannotation.targetType-string: A type descriptor string of the argument being modified.
Returns
userdata [instance]: The mixin method builder this annotation is being applied to.
methodBuilder:modifyReturnValue(annotation)
Creates a @ModifyReturnValue annotation.
For more information see MixinExtras - ModifyReturnValue
Parameters
annotation-table: An annotation table that matches the@ModifyReturnValueannotation.
Returns
userdata [instance]: The mixin method builder this annotation is being applied to.
methodBuilder:wrapMethod(annotation)
Creates a @WrapMethod annotation.
For more information see MixinExtras - WrapMethod
Parameters
annotation-table: An annotation table that matches the@WrapMethodannotation.
Returns
userdata [instance]: The mixin method builder this annotation is being applied to.
methodBuilder:custom(annotation, annotationType, methodDescriptor, parameterTypes, returnType)
Creates a custom injector annotation.
Parameters
annotation-table: An annotation table that matches the givenannotationType.annotationType-userdata [class]: The annotation class to be used.methodDescriptor-string: The target method's descriptor string.parameterTypes-table<string>: The parameters of the injector method. These may differ from the target method's descriptor.returnType-string: The return type of the injector method. This may differ from the target method's descriptor.
Returns
userdata [instance]: The mixin method builder this annotation is being applied to.
methodBuilder:expression(annotation)
Creates an @Expression annotation. This method does not produce an injector annotation and may be used multiple times within an inject method.
For more information see MixinExtras - Expressions
Parameters
annotation-table: An annotation table that matches the@Expressionannotation.
Returns
userdata [instance]: The mixin method builder this annotation is being applied to.
methodBuilder:definition(annotation)
Creates a @Definition annotation. This method does not produce an injector annotation and may be used multiple times within an inject method.
For more information see MixinExtras - Expressions
Parameters
annotation-table: An annotation table that matches the@Definitionannotation.
Returns
userdata [instance]: The mixin method builder this annotation is being applied to.
methodBuidler:localref(type, annotation, mutable)
Creates a parameter with a @Local annotation.
See MixinExtras Wiki - Local for more information.
Parameters
type-string: A type descriptor string of the parameter.annotation-table?: An optional annotation table that matches the@Localannotation.mutable-boolean?: Whether this parameter should be mutable.
WARNING
Setting mutable to true changes the parameter's type from the one passed in type to one from the LocalRef family.
Returns
userdata [instance]: The mixin method builder this parameter annotation is being applied to.
methodBuidler:share(type, annotation)
Creates a parameter with a @Share annotation.
See MixinExtras Wiki - Share for more information.
Parameters
type-string: A type descriptor string of the parameter.annotation-table?: An optional annotation table that matches the@Shareannotation.
Returns
userdata [instance]: The mixin method builder this parameter annotation is being applied to.
methodBuidler:cancellable()
Creates a parameter with a @Cancellable annotation.
See MixinExtras Wiki - Cancellable for more information.
Returns
userdata [instance]: The mixin method builder this parameter annotation is being applied to.