package annotation import "strings" const ( ResourceTag = "@Resource" ) type Resource struct { Annotation Name string } func ParseResource(a string) (*Resource, error) { i := strings.Index(a, ResourceTag) if -1 == i { return nil, nil } inject := &Resource{} atts, err := ParseAttribute(a, i+len(ResourceTag)) if nil != err { return nil, err } for k, v := range atts { switch k { case "name": inject.Name = v } } return inject, nil }