di-go/injection/annotation/component.go

25 lines
698 B
Go
Raw Permalink 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"`
2019-11-11 13:52:10 +00:00
Name string `json:"name"`
InitMethod string `json:"initMethod"` // func (receiver interface{}, cr ComponentRegistry) error
DestroyMethod string `json:"destroyMethod"` // func (receiver interface{}, cr ComponentRegistry) error
Scope di.ScopeType `json:"scope"`
2018-04-03 09:02:31 +00:00
}