ing
This commit is contained in:
parent
8c5c5b0311
commit
84645a5b4d
|
@ -71,10 +71,10 @@ func (cr *defaultComponentRegistry) RegisterType(t reflect.Type) {
|
||||||
log.Panicf("DI: %v", err)
|
log.Panicf("DI: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := cr.definitionByType[td.RealType]; ok {
|
if _, ok := cr.definitionByType[td.Type]; ok {
|
||||||
log.Panicf("DI: The type[%s] of Component is exist already", td.FullName)
|
log.Panicf("DI: The type[%s] of Component is exist already", td.FullName)
|
||||||
}
|
}
|
||||||
cr.definitionByType[td.RealType] = td
|
cr.definitionByType[td.Type] = td
|
||||||
|
|
||||||
name := td.TypeName
|
name := td.TypeName
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ func (cr *defaultComponentRegistry) GetInstance(t reflect.Type) (interface{}, er
|
||||||
)
|
)
|
||||||
|
|
||||||
rt, _, _ := cur.GetTypeInfo(t)
|
rt, _, _ := cur.GetTypeInfo(t)
|
||||||
if td, ok = cr.definitionByType[rt]; !ok {
|
if td, ok = cr.definitionByType[t]; !ok {
|
||||||
if td, err = cr.buildDefinition(t); nil != err {
|
if td, err = cr.buildDefinition(t); nil != err {
|
||||||
return nil, fmt.Errorf("DI: %v", err)
|
return nil, fmt.Errorf("DI: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -253,9 +253,7 @@ func GetMethodAnnotation(instanceType reflect.Type, annotationType reflect.Type,
|
||||||
return registry.GetMethodAnnotation(instanceType, annotationType, methodName)
|
return registry.GetMethodAnnotation(instanceType, annotationType, methodName)
|
||||||
}
|
}
|
||||||
func (cr *defaultComponentRegistry) GetMethodAnnotation(instanceType reflect.Type, annotationType reflect.Type, methodName string) cda.Annotation {
|
func (cr *defaultComponentRegistry) GetMethodAnnotation(instanceType reflect.Type, annotationType reflect.Type, methodName string) cda.Annotation {
|
||||||
rt, _, _ := cur.GetTypeInfo(instanceType)
|
def, ok := cr.definitionByType[instanceType]
|
||||||
|
|
||||||
def, ok := cr.definitionByType[rt]
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -267,9 +265,7 @@ func GetMethodAnnotations(instanceType reflect.Type, annotationType reflect.Type
|
||||||
return registry.GetMethodAnnotations(instanceType, annotationType)
|
return registry.GetMethodAnnotations(instanceType, annotationType)
|
||||||
}
|
}
|
||||||
func (cr *defaultComponentRegistry) GetMethodAnnotations(instanceType reflect.Type, annotationType reflect.Type) map[string]cda.Annotation {
|
func (cr *defaultComponentRegistry) GetMethodAnnotations(instanceType reflect.Type, annotationType reflect.Type) map[string]cda.Annotation {
|
||||||
rt, _, _ := cur.GetTypeInfo(instanceType)
|
def, ok := cr.definitionByType[instanceType]
|
||||||
|
|
||||||
def, ok := cr.definitionByType[rt]
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user