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 }