48 lines
880 B
Go
48 lines
880 B
Go
package registry
|
|
|
|
import (
|
|
"fmt"
|
|
"reflect"
|
|
|
|
cda "git.loafle.net/commons_go/di/annotation"
|
|
)
|
|
|
|
type TypeDefinition struct {
|
|
FullName string
|
|
PkgName string
|
|
TypeName string
|
|
Type reflect.Type
|
|
RealType reflect.Type
|
|
|
|
TypeAnnotations map[string]cda.Annotation
|
|
Fields []*FieldDefinition
|
|
}
|
|
|
|
func (td *TypeDefinition) GetAnnotation(name string) cda.Annotation {
|
|
if nil == td.TypeAnnotations {
|
|
return nil
|
|
}
|
|
return td.TypeAnnotations[name]
|
|
}
|
|
|
|
type FieldDefinition struct {
|
|
FieldName string
|
|
PkgName string
|
|
TypeName string
|
|
Type reflect.Type
|
|
RealType reflect.Type
|
|
|
|
Annotations map[string]cda.Annotation
|
|
}
|
|
|
|
func (fd *FieldDefinition) GetAnnotation(name string) cda.Annotation {
|
|
if nil == fd.Annotations {
|
|
return nil
|
|
}
|
|
return fd.Annotations[name]
|
|
}
|
|
|
|
func FullName(pkgName, typeName string) string {
|
|
return fmt.Sprintf("%s/%s", pkgName, typeName)
|
|
}
|