factory

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Overview

Package factory provides hiboot factory interface

Package factory provides InstantiateFactory and ConfigurableFactory interface

Index

Constants

View Source
const (
	// InstantiateFactoryName is the instance name of factory.instantiateFactory
	InstantiateFactoryName = "github.com/hidevopsio/hiboot/pkg/factory.instantiateFactory"
	// ConfigurableFactoryName is the instance name of factory.configurableFactory
	ConfigurableFactoryName = "github.com/hidevopsio/hiboot/pkg/factory.configurableFactory"
)
View Source
const (
	ScopeSingleton = "singleton"
	ScopePrototype = "prototype"
	ScopeRequest   = "request"
)

Variables

This section is empty.

Functions

func GetObjectQualifierName added in v1.5.0

func GetObjectQualifierName(object interface{}, name string) string

GetObjectQualifierName get the qualifier's name of object

func ParseParams added in v0.9.3

func ParseParams(params ...interface{}) (name string, object interface{})

ParseParams parse parameters

Types

type ConfigurableFactory added in v0.5.4

type ConfigurableFactory interface {
	InstantiateFactory
	SystemConfiguration() *system.Configuration
	Configuration(name string) interface{}
	BuildProperties() (systemConfig *system.Configuration, err error)
	StartSchedulers(schedulerServices []*MetaData) (schedulers []*scheduler.Scheduler)
	Build(configs []*MetaData)
}

ConfigurableFactory configurable factory interface

type Configuration added in v0.9.3

type Configuration interface {
}

Configuration configuration interface

type Deps added in v0.9.3

type Deps struct {
	// contains filtered or unexported fields
}

Deps the dependency mapping of configuration

func (*Deps) Get added in v0.9.3

func (c *Deps) Get(name string) (deps []string)

Get get the dependencies mapping

func (*Deps) Set added in v0.9.3

func (c *Deps) Set(dep interface{}, value []string)

Set set dependencies

type Factory

type Factory interface{}

Factory interface

type InstanceContainer added in v1.8.0

type InstanceContainer interface {
	Get(params ...interface{}) (retVal interface{})
	Set(params ...interface{}) (err error)
	Items() map[string]interface{}
}

type InstantiateFactory added in v0.5.4

type InstantiateFactory interface {
	Initialized() bool
	SetInstance(params ...interface{}) (err error)
	GetInstance(params ...interface{}) (retVal interface{})
	GetInstances(params ...interface{}) (retVal []*MetaData)
	Items() map[string]interface{}
	Append(i ...interface{})
	AppendComponent(c ...interface{})
	BuildComponents() (err error)
	Builder() (builder system.Builder)
	GetProperty(name string) interface{}
	SetProperty(name string, value interface{}) InstantiateFactory
	SetDefaultProperty(name string, value interface{}) InstantiateFactory
	DefaultProperties() map[string]interface{}
	InjectIntoFunc(instanceContainer InstanceContainer, object interface{}) (retVal interface{}, err error)
	InjectIntoMethod(instanceContainer InstanceContainer, owner, object interface{}) (retVal interface{}, err error)
	InjectDefaultValue(object interface{}) error
	InjectIntoObject(instanceContainer InstanceContainer, object interface{}) error
	InjectDependency(instanceContainer InstanceContainer, object interface{}) (err error)
	Replace(name string) interface{}
	InjectScopedObjects(ctx context.Context, dependencies []*MetaData, ic InstanceContainer) (instanceContainer InstanceContainer, err error)
	InjectScopedDependencies(instanceContainer InstanceContainer, dependencies []*MetaData) (err error)
}

InstantiateFactory instantiate factory interface

type MetaData added in v0.9.0

type MetaData struct {
	Kind        string
	Name        string
	ShortName   string
	TypeName    string
	PkgName     string
	InstName    string
	ObjectOwner interface{}
	MetaObject  interface{}
	Type        reflect.Type
	DepNames    []string
	DepMetaData []*MetaData
	Scope       string
	BeforeInit  bool
	AfterInit   bool
	Instance    interface{}
}

MetaData is the injectable object meta data

func CastMetaData added in v0.11.0

func CastMetaData(object interface{}) (metaData *MetaData)

CastMetaData cast object to *factory.MetaData

func CloneMetaData added in v0.11.0

func CloneMetaData(src *MetaData) (dst *MetaData)

CloneMetaData is the func for cloning metadata

func NewMetaData added in v0.9.0

func NewMetaData(params ...interface{}) (metaData *MetaData)

NewMetaData create new meta data

Directories

Path Synopsis
Package autoconfigure implement ConfigurableFactory
Package autoconfigure implement ConfigurableFactory
Package depends provides dependency resolver for factory
Package depends provides dependency resolver for factory
bar
Package bar is the test package for package depends
Package bar is the test package for package depends
fake
Package fake is the test package for package depends
Package fake is the test package for package depends
foo
Package foo is the test package for package depends
Package foo is the test package for package depends
Package instantiate implement InstantiateFactory
Package instantiate implement InstantiateFactory

Jump to

Keyboard shortcuts

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