ing
This commit is contained in:
parent
f7be0e92c5
commit
9d80d778c6
30
registry.go
30
registry.go
|
@ -244,12 +244,12 @@ func (r *AnnotationRegistry) GetTypeAnnotation(t reflect.Type, at reflect.Type)
|
||||||
}
|
}
|
||||||
|
|
||||||
if 0 == len(td.typeAnnotation) {
|
if 0 == len(td.typeAnnotation) {
|
||||||
return nil, fmt.Errorf("TypeAnnotation of type[%s] is not exist", td.rt.Name())
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
a, ok := td.typeAnnotation[at]
|
a, ok := td.typeAnnotation[at]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("Annotation[%s] of type[%s] is not exist", at.Name(), td.rt.Name())
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return a, nil
|
return a, nil
|
||||||
|
@ -265,7 +265,7 @@ func (r *AnnotationRegistry) GetTypeAnnotations(t reflect.Type) (map[reflect.Typ
|
||||||
}
|
}
|
||||||
|
|
||||||
if 0 == len(td.typeAnnotation) {
|
if 0 == len(td.typeAnnotation) {
|
||||||
return nil, fmt.Errorf("TypeAnnotation of type[%s] is not exist", td.rt.Name())
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return td.typeAnnotation, nil
|
return td.typeAnnotation, nil
|
||||||
|
@ -281,17 +281,17 @@ func (r *AnnotationRegistry) GetFieldAnnotation(t reflect.Type, name string, at
|
||||||
}
|
}
|
||||||
|
|
||||||
if 0 == len(td.fieldAnnotation) {
|
if 0 == len(td.fieldAnnotation) {
|
||||||
return nil, fmt.Errorf("FieldAnnotation of type[%s] is not exist", td.rt.Name())
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
as, ok := td.fieldAnnotation[name]
|
as, ok := td.fieldAnnotation[name]
|
||||||
if !ok || 0 == len(as) {
|
if !ok || 0 == len(as) {
|
||||||
return nil, fmt.Errorf("Field[%s] Annotation of type[%s] is not exist", name, td.rt.Name())
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
a, ok := as[at]
|
a, ok := as[at]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("Annotation[%s] of field[%s] in type[%s] is not exist", at.Name(), name, td.rt.Name())
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return a, nil
|
return a, nil
|
||||||
|
@ -307,12 +307,12 @@ func (r *AnnotationRegistry) GetFieldAnnotations(t reflect.Type, name string) (m
|
||||||
}
|
}
|
||||||
|
|
||||||
if 0 == len(td.fieldAnnotation) {
|
if 0 == len(td.fieldAnnotation) {
|
||||||
return nil, fmt.Errorf("FieldAnnotation of type[%s] is not exist", td.rt.Name())
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
as, ok := td.fieldAnnotation[name]
|
as, ok := td.fieldAnnotation[name]
|
||||||
if !ok || 0 == len(as) {
|
if !ok || 0 == len(as) {
|
||||||
return nil, fmt.Errorf("Field[%s] Annotation of type[%s] is not exist", name, td.rt.Name())
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return as, nil
|
return as, nil
|
||||||
|
@ -328,7 +328,7 @@ func (r *AnnotationRegistry) GetAllFieldAnnotations(t reflect.Type) (map[string]
|
||||||
}
|
}
|
||||||
|
|
||||||
if 0 == len(td.fieldAnnotation) {
|
if 0 == len(td.fieldAnnotation) {
|
||||||
return nil, fmt.Errorf("FieldAnnotation of type[%s] is not exist", td.rt.Name())
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return td.fieldAnnotation, nil
|
return td.fieldAnnotation, nil
|
||||||
|
@ -344,17 +344,17 @@ func (r *AnnotationRegistry) GetMethodAnnotation(t reflect.Type, name string, at
|
||||||
}
|
}
|
||||||
|
|
||||||
if 0 == len(td.methodAnnotation) {
|
if 0 == len(td.methodAnnotation) {
|
||||||
return nil, fmt.Errorf("MethodAnnotation of type[%s] is not exist", td.rt.Name())
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
as, ok := td.methodAnnotation[name]
|
as, ok := td.methodAnnotation[name]
|
||||||
if !ok || 0 == len(as) {
|
if !ok || 0 == len(as) {
|
||||||
return nil, fmt.Errorf("Method[%s] Annotation of type[%s] is not exist", name, td.rt.Name())
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
a, ok := as[at]
|
a, ok := as[at]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("Annotation[%s] of method[%s] in type[%s] is not exist", at.Name(), name, td.rt.Name())
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return a, nil
|
return a, nil
|
||||||
|
@ -370,12 +370,12 @@ func (r *AnnotationRegistry) GetMethodAnnotations(t reflect.Type, name string) (
|
||||||
}
|
}
|
||||||
|
|
||||||
if 0 == len(td.methodAnnotation) {
|
if 0 == len(td.methodAnnotation) {
|
||||||
return nil, fmt.Errorf("MethodAnnotation of type[%s] is not exist", td.rt.Name())
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
as, ok := td.methodAnnotation[name]
|
as, ok := td.methodAnnotation[name]
|
||||||
if !ok || 0 == len(as) {
|
if !ok || 0 == len(as) {
|
||||||
return nil, fmt.Errorf("Method[%s] Annotation of type[%s] is not exist", name, td.rt.Name())
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return as, nil
|
return as, nil
|
||||||
|
@ -391,7 +391,7 @@ func (r *AnnotationRegistry) GetAllMethodAnnotations(t reflect.Type) (map[string
|
||||||
}
|
}
|
||||||
|
|
||||||
if 0 == len(td.methodAnnotation) {
|
if 0 == len(td.methodAnnotation) {
|
||||||
return nil, fmt.Errorf("MethodAnnotation of type[%s] is not exist", td.rt.Name())
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return td.methodAnnotation, nil
|
return td.methodAnnotation, nil
|
||||||
|
|
Loading…
Reference in New Issue
Block a user