Documentation
¶
Overview ¶
Package aspect provides interfaces for AspectGo AOP framework.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aspect ¶
type Aspect interface {
// Pointcut returns the pointcut for the aspect.
// Pointcut is executed on compilation-time.
Pointcut() Pointcut
// Advice executes the "around" advice.
// User must be careful about the length and the type of
// the []interface{} slice.
// The slice can be empty []interface{}{}, but cannot be nil.
Advice(Context) []interface{}
}
Aspect is the interface for aspect definition. Currently, only "around" type advice is supported.
type Context ¶
type Context interface {
// Args returns the original argument set for the joinpoint.
// The slice can be empty []interface{}{}, but cannot be nil.
Args() []interface{}
// Call calls the joinpoint.
// User must be careful about the length and the type of
// the []interface{} slices.
// The slices can be empty []interface{}{}, but cannot be nil.
Call([]interface{}) []interface{}
// Receiver returns the receiver for methods.
// For non-method function, it just returns nil.
Receiver() interface{}
}
Context is the type for joinpoint context definition.
type Pointcut ¶
type Pointcut string
Pointcut is the type for pointcut definition. User should NOT be aware of the internal representation. (string) Currently, only "call" pointcut is supported. TODO: support "execution" pointcut.
func NewCallPointcutFromRegexp ¶
NewCallPointcutFromRegexp creates a "call" pointcut from s. s needs to be a regexp for function/method name.
func NewExecPointcutFromRegexp ¶
NewExecPointcutFromRegexp creates a "execution" pointcut from s. s needs to be a regexp for function/method name.