Documentation ¶
Index ¶
- Constants
- Variables
- func BoolInject(value reflect.Value, val string) error
- func FloatInject(value reflect.Value, val string) error
- func IntInject(value reflect.Value, val string) error
- func NewBeanContainer() *defaultBeanContainer
- func NewConditionOnBeanName(beanName string, exit bool) *conditionOnBeanName
- func NewConditionOnBeanType(beanType reflect.Type, exit bool) *conditionOnBeanType
- func NewConfigBase(base string) *configBase
- func NewConfigLoader() *configAutoLoader
- func PtrInject(value reflect.Value, val string) error
- func SliceInject(value reflect.Value, val string) error
- func StringInject(value reflect.Value, val string) error
- func StructInject(value reflect.Value, val string) error
- func UintInject(value reflect.Value, val string) error
- type BeanBeanConditionInjector
- type BeanInitDriver
- type EmptyBeanContainer
- type FuncStringValueInjector
- type FuncTagParser
- type IBeanAfterTagProcess
- type IBeanBeforeTagProcess
- type IBeanCondition
- type IBeanConditionInjector
- type IBeanContainer
- type IBeanContainerBuilder
- type IBeanFinishAssembly
- type IBeanInit
- type IBeanName
- type IBeanStart
- type IBeanStartAssembly
- type IConfigBase
- type IConfigLoader
- type IPriority
- type IStringValueInjector
- type ITagParser
- type ITagProcessor
- type ITagProcessorPriority
- type PropertyInjectGroup
Constants ¶
View Source
const ( BeanTagProcessor = "bean" BeanTag = "bean" // 必须存在,如果装配时不存在会报错,默认是true BeanRequiredTag = "bean.required" )
* bean相关tag处理
View Source
const ( ConfigTagProcessor = "config" // 从配置文件中读取的配置项 ValueConfigTag = "cfg" ValueConfigDomainTag = "cfg.d" // 默认配置项 ValueDefaultTag = "cfg.default" )
* cfg相关tag处理
View Source
const ( PrioritySystem = 0 PriorityHigh = 10000 PriorityMiddle = 100000 PriorityLow = 1000000 )
Variables ¶
View Source
var BeanConditionArrayType = reflect.TypeOf((*[]IBeanCondition)(nil)).Elem()
View Source
var BeanConditionInjectorHelper = struct { GetBeanConditionInjector func(beanContainer IBeanContainer) []IBeanConditionInjector BeanConditionInjector func(bcondition IBeanCondition, injecots []IBeanConditionInjector, beanContainer IBeanContainer) }{ GetBeanConditionInjector: getBeanConditionInjector, BeanConditionInjector: beanConditionInjector, }
View Source
var BeanConditionType = reflect.TypeOf((*IBeanCondition)(nil)).Elem()
View Source
var BeanProcessHelper = &beanProcessHelper{}
View Source
var IBeanAfterTagProcessType = reflect.TypeOf((*IBeanAfterTagProcess)(nil)).Elem()
View Source
var IBeanBeforeTagProcessType = reflect.TypeOf((*IBeanBeforeTagProcess)(nil)).Elem()
View Source
var IBeanFinishAssemblyType = reflect.TypeOf((*IBeanFinishAssembly)(nil)).Elem()
View Source
var IBeanNameType = reflect.TypeOf((*IBeanName)(nil)).Elem()
View Source
var IBeanStartAssemblyType = reflect.TypeOf((*IBeanStartAssembly)(nil)).Elem()
View Source
var IConfigBaseType = reflect.TypeOf((*IConfigBase)(nil)).Elem()
View Source
var IPriorityType = reflect.TypeOf((*IPriority)(nil)).Elem()
View Source
var ITagParserType = reflect.TypeOf((*ITagParser)(nil)).Elem()
View Source
var ITagProcessorPriorityType = reflect.TypeOf((*ITagProcessorPriority)(nil)).Elem()
View Source
var ITagProcessorType = reflect.TypeOf((*ITagProcessor)(nil)).Elem()
View Source
var StringPropertyInjects = &PropertyInjectGroup{ map[reflect.Kind]IStringValueInjector{ reflect.Bool: FuncStringValueInjector(BoolInject), reflect.Int: FuncStringValueInjector(IntInject), reflect.Int8: FuncStringValueInjector(IntInject), reflect.Int16: FuncStringValueInjector(IntInject), reflect.Int32: FuncStringValueInjector(IntInject), reflect.Int64: FuncStringValueInjector(IntInject), reflect.Uint: FuncStringValueInjector(UintInject), reflect.Uint8: FuncStringValueInjector(UintInject), reflect.Uint16: FuncStringValueInjector(UintInject), reflect.Uint32: FuncStringValueInjector(UintInject), reflect.Uint64: FuncStringValueInjector(UintInject), reflect.Float32: FuncStringValueInjector(FloatInject), reflect.Float64: FuncStringValueInjector(FloatInject), reflect.Slice: FuncStringValueInjector(SliceInject), reflect.String: FuncStringValueInjector(StringInject), reflect.Struct: FuncStringValueInjector(StructInject), reflect.Ptr: FuncStringValueInjector(PtrInject), }, }
View Source
var TagParserHelper = &tagParserHelper{}
View Source
var TagProcessorHelper = &tagProcessorHelper{}
Functions ¶
func NewBeanContainer ¶
func NewBeanContainer() *defaultBeanContainer
func NewConditionOnBeanName ¶
func NewConditionOnBeanType ¶
func NewConfigBase ¶
func NewConfigBase(base string) *configBase
func NewConfigLoader ¶
func NewConfigLoader() *configAutoLoader
Types ¶
type BeanBeanConditionInjector ¶
type BeanBeanConditionInjector struct { }
func NewBeanBeanConditionInjector ¶
func NewBeanBeanConditionInjector() *BeanBeanConditionInjector
func (*BeanBeanConditionInjector) BeanConditionInjector ¶
func (this *BeanBeanConditionInjector) BeanConditionInjector(bcondition IBeanCondition, beanContainer IBeanContainer)
type BeanInitDriver ¶
type BeanInitDriver struct { BeansInit []IBeanInit `bean:""` BeansStart []IBeanStart `bean:""` // contains filtered or unexported fields }
func NewBeanInitDriver ¶
func NewBeanInitDriver() *BeanInitDriver
func (*BeanInitDriver) CallInit ¶
func (this *BeanInitDriver) CallInit()
func (*BeanInitDriver) CallStart ¶
func (this *BeanInitDriver) CallStart()
func (*BeanInitDriver) CallStop ¶
func (this *BeanInitDriver) CallStop()
func (*BeanInitDriver) CallUnInit ¶
func (this *BeanInitDriver) CallUnInit()
type EmptyBeanContainer ¶
type EmptyBeanContainer struct { }
type FuncStringValueInjector ¶
func (FuncStringValueInjector) StringValueInjector ¶
func (this FuncStringValueInjector) StringValueInjector(value reflect.Value, val string) error
type FuncTagParser ¶
type IBeanAfterTagProcess ¶
type IBeanAfterTagProcess interface { // tag后缀处理 BeanAfterTagProcess(tagProcessor ITagProcessor, beanContainer IBeanContainer) }
type IBeanBeforeTagProcess ¶
type IBeanBeforeTagProcess interface { // tag前置处理 BeanBeforeTagProcess(tagProcessor ITagProcessor, beanContainer IBeanContainer) }
type IBeanCondition ¶
type IBeanCondition interface {
IsConditionPass() bool
}
* bean的装配条件,只有IsConditionPass才会进入装配,并放入到BeanContainer
func NewConditionAnd ¶
func NewConditionAnd(conditions ...IBeanCondition) IBeanCondition
func NewConditionNot ¶
func NewConditionNot(condition IBeanCondition) IBeanCondition
func NewConditionOnValue ¶
func NewConditionOnValue(value string, exist bool) IBeanCondition
func NewConditionOr ¶
func NewConditionOr(conditions ...IBeanCondition) IBeanCondition
type IBeanConditionInjector ¶
type IBeanConditionInjector interface {
BeanConditionInjector(bcondition IBeanCondition, beanContainer IBeanContainer)
}
type IBeanContainer ¶
type IBeanContainer interface { // 用这个加入的bean会直接加入容器,忽略装配,装配在builder中完成 AddBean(beans ...interface{}) AddNamedBean(name string, bean interface{}) // 通过类型获取bean GetBeanByType(pt reflect.Type) []interface{} // 通过名字获取bean GetBeanByName(name string) interface{} // 获取所有的bean GetAllBeans() []interface{} }
bean容器
type IBeanContainerBuilder ¶
type IBeanContainerBuilder interface { AddBean(bean ...interface{}) AddNamedBean(name string, bean interface{}) GetBeanContainer() IBeanContainer Build() }
func NewBeanContainerBuilder ¶
func NewBeanContainerBuilder() IBeanContainerBuilder
type IBeanFinishAssembly ¶
type IBeanFinishAssembly interface { // tag前置处理 BeanFinishAssembly(beanContainer IBeanContainer) }
type IBeanStart ¶
type IBeanStart interface { BeanStart() BeanStop() }
type IBeanStartAssembly ¶
type IBeanStartAssembly interface { // tag前置处理 BeanStartAssembly(beanContainer IBeanContainer) }
type IConfigBase ¶
type IConfigBase interface {
ConfigBase() string
}
type IConfigLoader ¶
type IStringValueInjector ¶
type ITagProcessor ¶
type ITagProcessor interface { TagProcessorName() string // tag开始处理前会调用一次 PrepareProcess() TagProcess(bean interface{}, fType reflect.StructField, fValue reflect.Value, tags map[string]string) }
func NewBeanTagProcessor ¶
func NewBeanTagProcessor(beanContainer IBeanContainer) ITagProcessor
func NewConfigValueTagProcessor ¶
func NewConfigValueTagProcessor(conf IConfigLoader) ITagProcessor
type ITagProcessorPriority ¶
type ITagProcessorPriority interface {
GetTagProcessorPriority() int
}
type PropertyInjectGroup ¶
type PropertyInjectGroup struct {
// contains filtered or unexported fields
}
func (*PropertyInjectGroup) Inject ¶
func (this *PropertyInjectGroup) Inject(value reflect.Value, val string) error
func (*PropertyInjectGroup) StringValueInjector ¶
func (this *PropertyInjectGroup) StringValueInjector(value reflect.Value, val string) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.