aspect

package
v0.0.0-...-8abddbd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2016 License: BSD-3-Clause Imports: 1 Imported by: 12

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

func NewCallPointcutFromRegexp(s string) Pointcut

NewCallPointcutFromRegexp creates a "call" pointcut from s. s needs to be a regexp for function/method name.

func NewExecPointcutFromRegexp

func NewExecPointcutFromRegexp(s string) Pointcut

NewExecPointcutFromRegexp creates a "execution" pointcut from s. s needs to be a regexp for function/method name.

func (Pointcut) String

func (pc Pointcut) String() string

Directories

Path Synopsis
Package rt provides the internal runtime package for AspectGo.
Package rt provides the internal runtime package for AspectGo.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL