di-go/injection/annotation/component.go
crusader 52ae4371ce ing
2018-04-07 01:57:25 +09:00

25 lines
726 B
Go

package annotation
// @Inject(name? string)
import (
"reflect"
"git.loafle.net/commons/di-go"
cda "git.loafle.net/commons/di-go/annotation"
)
var ComponentAnnotationType = reflect.TypeOf((*ComponentAnnotation)(nil))
func init() {
cda.RegisterAnnotation(ComponentAnnotationType)
}
type ComponentAnnotation struct {
cda.TypeAnnotation `@annotation:"@Component"`
Name string `@annotation:"name"`
InitMethod string `@annotation:"initMethod"` // func (receiver interface{}, cr ComponentRegistry) error
DestroyMethod string `@annotation:"destroyMethod"` // func (receiver interface{}, cr ComponentRegistry) error
Scope di.ScopeType `@annotation:"scope"`
}