di-go/injection/annotation/component.go

25 lines
726 B
Go
Raw Normal View History

2018-04-03 09:02:31 +00:00
package annotation
// @Inject(name? string)
import (
"reflect"
"git.loafle.net/commons/di-go"
cda "git.loafle.net/commons/di-go/annotation"
)
2018-04-06 16:57:25 +00:00
var ComponentAnnotationType = reflect.TypeOf((*ComponentAnnotation)(nil))
2018-04-03 09:02:31 +00:00
func init() {
2018-04-06 16:57:25 +00:00
cda.RegisterAnnotation(ComponentAnnotationType)
2018-04-03 09:02:31 +00:00
}
2018-04-06 16:57:25 +00:00
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"`
2018-04-03 09:02:31 +00:00
}