32 lines
694 B
Go
32 lines
694 B
Go
|
package annotation
|
||
|
|
||
|
// @Inject(name? string)
|
||
|
|
||
|
import (
|
||
|
"reflect"
|
||
|
|
||
|
oa "git.loafle.net/overflow/annotation-go"
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
oa.Register(InjectableAnnotationType)
|
||
|
}
|
||
|
|
||
|
var InjectableAnnotationType = reflect.TypeOf((*InjectableAnnotation)(nil))
|
||
|
|
||
|
type InjectableAnnotation struct {
|
||
|
oa.Annotation `@name:"@Injectable"`
|
||
|
Name string `json:"name" @default:""`
|
||
|
InitMethod string `json:"initMethod"`
|
||
|
DestroyMethod string `json:"destroyMethod"`
|
||
|
Scope ScopeType `json:"scope"`
|
||
|
}
|
||
|
|
||
|
type ScopeType string
|
||
|
|
||
|
const (
|
||
|
ScopeTypeDefault ScopeType = "Default" // == ScopeTypeSingleton
|
||
|
ScopeTypeSingleton ScopeType = "Singleton"
|
||
|
ScopeTypeTransiant ScopeType = "Transiant"
|
||
|
)
|