MethodAnnotationPrefix added
This commit is contained in:
parent
ef45ff4ad6
commit
430e8dc498
|
@ -10,6 +10,8 @@ const (
|
||||||
NameTag = "@name"
|
NameTag = "@name"
|
||||||
DefaultTag = "@default"
|
DefaultTag = "@default"
|
||||||
RequiredTag = "@required"
|
RequiredTag = "@required"
|
||||||
|
|
||||||
|
MethodAnnotationPrefix = "_"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -212,7 +212,11 @@ LOOP:
|
||||||
if 0 == len(td.methodAnnotation) {
|
if 0 == len(td.methodAnnotation) {
|
||||||
td.methodAnnotation = make(map[string]map[reflect.Type]Annotation, 0)
|
td.methodAnnotation = make(map[string]map[reflect.Type]Annotation, 0)
|
||||||
}
|
}
|
||||||
td.methodAnnotation[f.Name] = as
|
_name := strings.TrimLeft(f.Name, MethodAnnotationPrefix)
|
||||||
|
if "" == _name {
|
||||||
|
return nil, fmt.Errorf("name[%s] of method annotation is not valid", _name)
|
||||||
|
}
|
||||||
|
td.methodAnnotation[_name] = as
|
||||||
continue LOOP
|
continue LOOP
|
||||||
} else {
|
} else {
|
||||||
as, err := r.getAnnotation(&f)
|
as, err := r.getAnnotation(&f)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user