container

package
v1.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentFactoryPostProcessor

type ComponentFactoryPostProcessor interface {
	PostProcessComponentFactory(factory Factory) error
}

ComponentFactoryPostProcessor Used for Component to get Factory

type ComponentPostProcessor

type ComponentPostProcessor interface {
	// PostProcessBeforeInitialization called before InitializingComponent.AfterPropertiesSet and InitializeComponent.Init
	PostProcessBeforeInitialization(component any, componentName string) (any, error)
	// PostProcessAfterInitialization called after InitializingComponent.AfterPropertiesSet and InitializeComponent.Init
	PostProcessAfterInitialization(component any, componentName string) (any, error)
}

ComponentPostProcessor is an interface that provides extension points to modify components during their lifecycle in the IoC container

type DefinitionRegistry

type DefinitionRegistry interface {
	RegisterMeta(m *component_definition.Meta)
	GetMetas(opts ...Option) []*component_definition.Meta
	GetMetaByName(name string) *component_definition.Meta
	GetMetaOrRegister(name string, component any) *component_definition.Meta
}

type DefinitionRegistryPostProcessor

type DefinitionRegistryPostProcessor interface {
	PostProcessDefinitionRegistry(registry DefinitionRegistry, component any, componentName string) error
}

DefinitionRegistryPostProcessor Used to add custom Component Meta parsing capabilities

type DestructionAwareComponentPostProcessor

type DestructionAwareComponentPostProcessor interface {
	ComponentPostProcessor
	PostProcessBeforeDestruction(component any, componentName string) error
	RequireDestruction(component any) bool
}

type Factory

type Factory interface {
	GetRegisteredComponents() map[string]any
	GetDefinitionRegistryPostProcessors() []DefinitionRegistryPostProcessor
	SetRegistry(r SingletonRegistry)
	SetConfigure(c configure.Configure)
	PrepareComponents() error
	Refresh() error
	GetComponents(opts ...Option) ([]any, error)
	GetComponentByName(name string) (any, error)
	GetConfigure() configure.Configure
	GetDefinitionRegistry() DefinitionRegistry
}

type FactoryEvent added in v1.6.0

type FactoryEvent struct {
	Phase         string
	Action        string
	ComponentName string
	ProcessorName string
	Details       map[string]any
}

type FactoryHook added in v1.6.0

type FactoryHook interface {
	OnFactoryEvent(event FactoryEvent)
}

type FuncSingletonFactory

type FuncSingletonFactory func() (*component_definition.Meta, error)

func (FuncSingletonFactory) GetComponent

func (d FuncSingletonFactory) GetComponent() (*component_definition.Meta, error)

type InstantiationAwareComponentPostProcessor

type InstantiationAwareComponentPostProcessor interface {
	ComponentPostProcessor
	// PostProcessBeforeInstantiation Return a proxy instead of the real bean
	PostProcessBeforeInstantiation(m *component_definition.Meta, componentName string) (any, error)
	// PostProcessAfterInstantiation Return false to skip injection (PostProcessProperties) for certain components.
	PostProcessAfterInstantiation(component any, componentName string) (bool, error)
	// PostProcessProperties inject and modify the properties value for certain components
	PostProcessProperties(properties []*component_definition.Property, component any, componentName string) ([]*component_definition.Property, error)
}

InstantiationAwareComponentPostProcessor is an extension of ComponentPostProcessor that provides additional callbacks for intercepting component instantiation and dependency injection. It allows fine-grained control over the component lifecycle, particularly before instantiation and after property population (dependency injection).

type Option

type Option func(m *component_definition.Meta) bool

func And

func And(opts ...Option) Option

func FuncName

func FuncName(fn string) Option

func FuncNameAndResult

func FuncNameAndResult(fn, result string) Option

func Interface

func Interface(a any) Option

func InterfaceType

func InterfaceType(typ reflect.Type) Option

func Or

func Or(opts ...Option) Option

func Type

func Type(typ reflect.Type) Option

type SingletonComponentRegistry

type SingletonComponentRegistry interface {
	AddSingleton(name string, meta *component_definition.Meta)
	AddSingletonFactory(name string, method SingletonFactory)
	GetSingleton(name string, allowEarlyReference bool) (*component_definition.Meta, error)
	RemoveSingleton(name string)
	GetSingletonOrCreateByFactory(name string, factory SingletonFactory) (*component_definition.Meta, error)
	IsSingletonCurrentlyInCreation(name string) bool
}

type SingletonFactory

type SingletonFactory interface {
	GetComponent() (*component_definition.Meta, error)
}

type SingletonRegistry

type SingletonRegistry interface {
	RegisterSingleton(singleton any)
	GetSingleton(name string) (any, error)
	ContainsSingleton(name string) bool
	GetSingletonNames() []string
	GetSingletonCount() int
	GetConstructor(name string) (any, bool)
}

type SmartInstantiationAwareBeanPostProcessor

type SmartInstantiationAwareBeanPostProcessor interface {
	InstantiationAwareComponentPostProcessor
	GetEarlyBeanReference(component any, componentName string) (any, error)
}

SmartInstantiationAwareBeanPostProcessor is an advanced extension of InstantiationAwareComponentPostProcessor that provides additional capabilities for predicting component types, This interface is primarily used for:

- Circular dependency handling (exposing early bean references) - Proxy creation optimization

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL