di/annotation/resource.go
crusader 700f188618 ing
2017-12-06 15:07:44 +09:00

32 lines
470 B
Go

package annotation
import (
"fmt"
"reflect"
)
const (
ResourceTag = "@Resource"
)
func init() {
registerAnnotation(ResourceTag, reflect.TypeOf((*Resource)(nil)))
}
type Resource struct {
Annotation
Name string
}
func (a *Resource) parseAttribute(attributes map[string]string) error {
for k, v := range attributes {
switch k {
case "name":
a.Name = v
default:
return fmt.Errorf("Syntax error: not supported attribute[%s]", k)
}
}
return nil
}