25 lines
726 B
Go
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"`
|
|
}
|