di-go/injection/annotation/component.go
2019-11-11 22:52:10 +09:00

25 lines
698 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 `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"`
}