Documentation
¶
Index ¶
- func RegisterComponentFactory(system types.SystemInterface, factoryConfig types.FactoryConfig) error
- type BaseComponent
- type ComponentRegistrar
- func (cr *ComponentRegistrar) CreateComponent(ctx *common.Context, config *types.ComponentConfig) (types.ComponentInterface, error)
- func (cr *ComponentRegistrar) GetAllComponents() []types.ComponentInterface
- func (cr *ComponentRegistrar) GetAllFactories() []types.ComponentFactoryInterface
- func (cr *ComponentRegistrar) GetComponent(id string) (types.ComponentInterface, error)
- func (cr *ComponentRegistrar) GetComponentsByType(componentType types.ComponentType) []types.ComponentInterface
- func (cr *ComponentRegistrar) GetFactory(id string) (types.ComponentFactoryInterface, error)
- func (cr *ComponentRegistrar) RegisterFactory(ctx *common.Context, id string, factory types.ComponentFactoryInterface) error
- func (cr *ComponentRegistrar) UnregisterComponent(ctx *common.Context, id string) error
- func (cr *ComponentRegistrar) UnregisterFactory(ctx *common.Context, id string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterComponentFactory ¶ added in v0.1.2
func RegisterComponentFactory(system types.SystemInterface, factoryConfig types.FactoryConfig) error
Types ¶
type BaseComponent ¶
type BaseComponent struct {
types.ComponentInterface
Id string
Nm string
Desc string
}
BaseComponent represents a concrete implementation of the ComponentInterface.
func NewComponentImpl ¶
func NewComponentImpl(Id, Nm, Desc string) *BaseComponent
func (*BaseComponent) Description ¶
func (bc *BaseComponent) Description() string
Description returns the Desc of the component.
func (*BaseComponent) ID ¶
func (bc *BaseComponent) ID() string
ID returns the unique identifier of the component.
func (*BaseComponent) Name ¶
func (bc *BaseComponent) Name() string
Name returns the Nm of the component.
func (*BaseComponent) Type ¶
func (bc *BaseComponent) Type() types.ComponentType
Type returns the type of the component.
type ComponentRegistrar ¶
type ComponentRegistrar struct {
types.ComponentRegistrarInterface
// contains filtered or unexported fields
}
ComponentRegistrar defines the registry functionality for components and factories.
func NewComponentRegistrar ¶
func NewComponentRegistrar() *ComponentRegistrar
NewComponentRegistrar creates a new instance of ComponentRegistrar.
func (*ComponentRegistrar) CreateComponent ¶
func (cr *ComponentRegistrar) CreateComponent(ctx *common.Context, config *types.ComponentConfig) (types.ComponentInterface, error)
CreateComponent creates and registers a new instance of the component.
func (*ComponentRegistrar) GetAllComponents ¶
func (cr *ComponentRegistrar) GetAllComponents() []types.ComponentInterface
GetAllComponents returns a list of all registered components.
func (*ComponentRegistrar) GetAllFactories ¶
func (cr *ComponentRegistrar) GetAllFactories() []types.ComponentFactoryInterface
GetAllFactories returns a list of all registered component factories.
func (*ComponentRegistrar) GetComponent ¶
func (cr *ComponentRegistrar) GetComponent(id string) (types.ComponentInterface, error)
GetComponent retrieves the component with the specified ID.
func (*ComponentRegistrar) GetComponentsByType ¶
func (cr *ComponentRegistrar) GetComponentsByType(componentType types.ComponentType) []types.ComponentInterface
GetComponentsByType retrieves components of the specified type.
func (*ComponentRegistrar) GetFactory ¶
func (cr *ComponentRegistrar) GetFactory(id string) (types.ComponentFactoryInterface, error)
GetFactory retrieves the factory with the specified ID.
func (*ComponentRegistrar) RegisterFactory ¶
func (cr *ComponentRegistrar) RegisterFactory(ctx *common.Context, id string, factory types.ComponentFactoryInterface) error
RegisterFactory registers a factory with the given ID.
func (*ComponentRegistrar) UnregisterComponent ¶
func (cr *ComponentRegistrar) UnregisterComponent(ctx *common.Context, id string) error
UnregisterComponent unregisters the component with the specified ID.
func (*ComponentRegistrar) UnregisterFactory ¶
func (cr *ComponentRegistrar) UnregisterFactory(ctx *common.Context, id string) error
UnregisterFactory unregisters the factory with the specified ID.