inject

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NotImplementedError: the interface is not implemented
	NotImplementedError = errors.New("[inject] interface is not implemented")
	// InvalidObjectError: the object is invalid
	InvalidObjectError = errors.New("[inject] invalid object")
	// InvalidTagNameError the tag name is invalid
	InvalidTagNameError = errors.New("[inject] invalid tag name, e.g. exampleTag")
	// SystemConfigurationError system is not configured
	SystemConfigurationError = errors.New("[inject] system is not configured")

	// InvalidInputError
	InvalidInputError = errors.New("[inject] invalid input")
	// InvalidFuncError
	InvalidFuncError = errors.New("[inject] invalid func")

	// FactoryIsNilError
	FactoryIsNilError = errors.New("[inject] factory is nil")
)

Functions

func AddTag added in v0.3.0

func AddTag(tag Tag)

AddTag add new tag

func IntoFunc added in v0.6.0

func IntoFunc(object interface{}) (retVal interface{}, err error)

IntoMethod inject object into method and return instance

func IntoObject

func IntoObject(object interface{}) error

IntoObject injects instance into the tagged field with `inject:"instanceName"`

func IntoObjectValue added in v0.5.0

func IntoObjectValue(object reflect.Value) error

IntoObjectValue injects instance into the tagged field with `inject:"instanceName"`

func SetFactory added in v0.5.4

func SetFactory(f factory.ConfigurableFactory)

SetFactory set factory from app

Types

type BaseTag added in v0.3.0

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

func (*BaseTag) Decode added in v0.3.0

func (t *BaseTag) Decode(object reflect.Value, field reflect.StructField, tag string) (retVal interface{})

func (*BaseTag) Init added in v0.5.0

func (t *BaseTag) Init(systemConfig *system.Configuration, configurations cmap.ConcurrentMap)

func (*BaseTag) IsSingleton added in v0.3.0

func (t *BaseTag) IsSingleton() bool

func (*BaseTag) ParseProperties added in v0.3.0

func (t *BaseTag) ParseProperties(tag string) cmap.ConcurrentMap

func (*BaseTag) Properties added in v0.3.0

func (t *BaseTag) Properties() cmap.ConcurrentMap

type Tag added in v0.3.0

type Tag interface {
	Init(systemConfig *system.Configuration, configurations cmap.ConcurrentMap)
	Decode(object reflect.Value, field reflect.StructField, tag string) (retVal interface{})
	Properties() cmap.ConcurrentMap
	IsSingleton() bool
}

Jump to

Keyboard shortcuts

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