hiboot: hidevops.io/hiboot/pkg/factory Index | Files | Directories

package factory

import "hidevops.io/hiboot/pkg/factory"

Package factory provides hiboot factory interface

Package factory provides InstantiateFactory and ConfigurableFactory interface


Package Files

doc.go factory.go metadata.go


const (
    // InstantiateFactoryName is the instance name of factory.instantiateFactory
    InstantiateFactoryName = "factory.instantiateFactory"
    // ConfigurableFactoryName is the instance name of factory.configurableFactory
    ConfigurableFactoryName = "factory.configurableFactory"

func GetObjectQualifierName Uses

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

GetObjectQualifierName get the qualifier's name of object

func ParseParams Uses

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

ParseParams parse parameters

type ConfigurableFactory Uses

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

ConfigurableFactory configurable factory interface

type Configuration Uses

type Configuration interface {

Configuration configuration interface

type Deps Uses

type Deps struct {
    // contains filtered or unexported fields

Deps the dependency mapping of configuration

func (*Deps) Get Uses

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

Get get the dependencies mapping

func (*Deps) Set Uses

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

Set set dependencies

type Factory Uses

type Factory interface{}

Factory interface

type Instance Uses

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

type InstantiateFactory Uses

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(object interface{}) (retVal interface{}, err error)
    InjectIntoMethod(owner, object interface{}) (retVal interface{}, err error)
    InjectDefaultValue(object interface{}) error
    InjectIntoObject(object interface{}) error
    InjectDependency(object interface{}) (err error)
    Replace(name string) interface{}
    InjectContextAwareObjects(ctx context.Context, dps []*MetaData) (runtimeInstance Instance, err error)

InstantiateFactory instantiate factory interface

type MetaData Uses

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

MetaData is the injectable object meta data

func CastMetaData Uses

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

CastMetaData cast object to *factory.MetaData

func CloneMetaData Uses

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

CloneMetaData is the func for cloning meta data

func NewMetaData Uses

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

NewMetaData create new meta data


autoconfigurePackage autoconfigure implement ConfigurableFactory
dependsPackage depends provides dependency resolver for factory
depends/barPackage bar is the test package for package depends
depends/fakePackage fake is the test package for package depends
depends/fooPackage foo is the test package for package depends
instantiatePackage instantiate implement InstantiateFactory

Package factory imports 10 packages (graph) and is imported by 16 packages. Updated 2019-10-07. Refresh now. Tools for package owners.