peas

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: Apache-2.0 Imports: 4 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Procyon Peas

Go Report Card codecov Build Status Gitter PkgGoDev

This gives you a basic understanding of Procyon Peas Module. It covers components provided by the framework, such as Pea Processors and Initializers.

Note that you need to register pea processors and initializers by using the function core.Register.

Pea Definition Registry Processor

It's used to do something after Pea Definition Registry is initialized.

type PeaDefinitionRegistryProcessor interface {
	AfterPeaDefinitionRegistryInitialization(registry PeaDefinitionRegistry)
}

Pea Factory Processor

It's used to do something after Pea Factory is initialized.

type PeaFactoryProcessor interface {
	AfterPeaFactoryInitialization(factory ConfigurablePeaFactory)
}

Pea Processors and Initializers

BeforePeaInitialization, InitializePea and AfterPeaInitialization are invoked respectively.

Processor

Pea Processors are used to manipulate the instance while being created. For example, Binding the configuration properties are done by using Pea Processors.

You can look into ConfigurationPropertiesBindingProcessor for more information.

type PeaProcessor interface {
	BeforePeaInitialization(peaName string, pea interface{}) (interface{}, error)
	AfterPeaInitialization(peaName string, pea interface{}) (interface{}, error)
}
Initializer

Pea Initializers are used to initialize Pea instances. You can use to initialize your peas. It is invoked while the instance are created.

type PeaInitializer interface {
	InitializePea() error
}

License

Procyon Framework is released under version 2.0 of the Apache License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateInstance

func CreateInstance(typ goo.Type, args []interface{}) (interface{}, error)

Types

type ConfigurablePeaFactory

type ConfigurablePeaFactory interface {
	SharedPeaRegistry
	PeaFactory
	RegisterTypeAsOnlyReadable(typ goo.Type) error
	ExcludeType(typ goo.Type) error
	AddPeaProcessor(processor PeaProcessor) error
	GetPeaProcessors() []PeaProcessor
	GetPeaProcessorsCount() int
	PreInstantiateSharedPeas()
}

type DefaultPeaDefinitionRegistry

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

func NewDefaultPeaDefinitionRegistry

func NewDefaultPeaDefinitionRegistry() *DefaultPeaDefinitionRegistry

func (*DefaultPeaDefinitionRegistry) ContainsPeaDefinition

func (registry *DefaultPeaDefinitionRegistry) ContainsPeaDefinition(peaName string) bool

func (*DefaultPeaDefinitionRegistry) GetPeaDefinition

func (registry *DefaultPeaDefinitionRegistry) GetPeaDefinition(peaName string) PeaDefinition

func (*DefaultPeaDefinitionRegistry) GetPeaDefinitionCount

func (registry *DefaultPeaDefinitionRegistry) GetPeaDefinitionCount() int

func (*DefaultPeaDefinitionRegistry) GetPeaDefinitionNames

func (registry *DefaultPeaDefinitionRegistry) GetPeaDefinitionNames() []string

func (*DefaultPeaDefinitionRegistry) GetPeaNamesByType

func (registry *DefaultPeaDefinitionRegistry) GetPeaNamesByType(typ goo.Type) []string

func (*DefaultPeaDefinitionRegistry) RegisterPeaDefinition

func (registry *DefaultPeaDefinitionRegistry) RegisterPeaDefinition(peaName string, definition PeaDefinition)

func (*DefaultPeaDefinitionRegistry) RemovePeaDefinition

func (registry *DefaultPeaDefinitionRegistry) RemovePeaDefinition(peaName string)

type DefaultPeaFactory

type DefaultPeaFactory struct {
	SharedPeaRegistry
	PeaDefinitionRegistry
	// contains filtered or unexported fields
}

func NewDefaultPeaFactory

func NewDefaultPeaFactory() DefaultPeaFactory

func (DefaultPeaFactory) AddPeaProcessor

func (factory DefaultPeaFactory) AddPeaProcessor(processor PeaProcessor) error

Pea Processors

func (DefaultPeaFactory) ContainsPea

func (factory DefaultPeaFactory) ContainsPea(name string) bool

func (DefaultPeaFactory) ExcludeType

func (factory DefaultPeaFactory) ExcludeType(typ goo.Type) error

func (DefaultPeaFactory) GetPea

func (factory DefaultPeaFactory) GetPea(name string) (interface{}, error)

func (DefaultPeaFactory) GetPeaByNameAndArgs

func (factory DefaultPeaFactory) GetPeaByNameAndArgs(name string, args ...interface{}) (interface{}, error)

func (DefaultPeaFactory) GetPeaByNameAndType

func (factory DefaultPeaFactory) GetPeaByNameAndType(name string, typ goo.Type) (interface{}, error)

func (DefaultPeaFactory) GetPeaByType

func (factory DefaultPeaFactory) GetPeaByType(typ goo.Type) (interface{}, error)

func (DefaultPeaFactory) GetPeaProcessors

func (factory DefaultPeaFactory) GetPeaProcessors() []PeaProcessor

func (DefaultPeaFactory) GetPeaProcessorsCount

func (factory DefaultPeaFactory) GetPeaProcessorsCount() int

func (DefaultPeaFactory) PreInstantiateSharedPeas

func (factory DefaultPeaFactory) PreInstantiateSharedPeas()

func (DefaultPeaFactory) RegisterTypeAsOnlyReadable

func (factory DefaultPeaFactory) RegisterTypeAsOnlyReadable(typ goo.Type) error

type DefaultSharedPeaRegistry

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

func NewDefaultSharedPeaRegistry

func NewDefaultSharedPeaRegistry() *DefaultSharedPeaRegistry

func (*DefaultSharedPeaRegistry) ContainsSharedPea

func (registry *DefaultSharedPeaRegistry) ContainsSharedPea(peaName string) bool

func (*DefaultSharedPeaRegistry) GetSharedPea

func (registry *DefaultSharedPeaRegistry) GetSharedPea(peaName string) interface{}

func (*DefaultSharedPeaRegistry) GetSharedPeaCount

func (registry *DefaultSharedPeaRegistry) GetSharedPeaCount() int

func (*DefaultSharedPeaRegistry) GetSharedPeaNames

func (registry *DefaultSharedPeaRegistry) GetSharedPeaNames() []string

func (*DefaultSharedPeaRegistry) GetSharedPeaType

func (registry *DefaultSharedPeaRegistry) GetSharedPeaType(requiredType goo.Type) interface{}

func (*DefaultSharedPeaRegistry) GetSharedPeaWithObjectFunc

func (registry *DefaultSharedPeaRegistry) GetSharedPeaWithObjectFunc(peaName string, objFunc GetObjectFunc) (interface{}, error)

func (*DefaultSharedPeaRegistry) GetSharedPeasByType

func (registry *DefaultSharedPeaRegistry) GetSharedPeasByType(requiredType goo.Type) []interface{}

func (*DefaultSharedPeaRegistry) RegisterSharedPea

func (registry *DefaultSharedPeaRegistry) RegisterSharedPea(peaName string, sharedObject interface{}) error

type GetObjectFunc

type GetObjectFunc func() (interface{}, error)

type PeaDefinition

type PeaDefinition interface {
	GetTypeName() string
	GetPeaType() goo.Type
	GetScope() PeaScope
}

type PeaDefinitionHolder

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

func NewPeaDefinitionHolder

func NewPeaDefinitionHolder(peaName string, peaDefinition PeaDefinition) *PeaDefinitionHolder

func (*PeaDefinitionHolder) GetPeaDefinition

func (holder *PeaDefinitionHolder) GetPeaDefinition() PeaDefinition

func (*PeaDefinitionHolder) GetPeaName

func (holder *PeaDefinitionHolder) GetPeaName() string

type PeaDefinitionRegistry

type PeaDefinitionRegistry interface {
	RegisterPeaDefinition(peaName string, definition PeaDefinition)
	RemovePeaDefinition(peaName string)
	ContainsPeaDefinition(peaName string) bool
	GetPeaDefinition(peaName string) PeaDefinition
	GetPeaDefinitionNames() []string
	GetPeaDefinitionCount() int
	GetPeaNamesByType(typ goo.Type) []string
}

type PeaDefinitionRegistryProcessor

type PeaDefinitionRegistryProcessor interface {
	AfterPeaDefinitionRegistryInitialization(registry PeaDefinitionRegistry)
}

type PeaFactory

type PeaFactory interface {
	GetPea(name string) (interface{}, error)
	GetPeaByNameAndType(name string, typ goo.Type) (interface{}, error)
	GetPeaByNameAndArgs(name string, args ...interface{}) (interface{}, error)
	GetPeaByType(typ goo.Type) (interface{}, error)
	ContainsPea(name string) bool
}

type PeaFactoryProcessor

type PeaFactoryProcessor interface {
	AfterPeaFactoryInitialization(factory ConfigurablePeaFactory)
}

type PeaInPreparationError

type PeaInPreparationError struct {
	PeaPreparationError
}

func NewPeaInPreparationError

func NewPeaInPreparationError(peaName string) PeaInPreparationError

type PeaInitializer

type PeaInitializer interface {
	InitializePea() error
}

type PeaNameGenerator

type PeaNameGenerator interface {
	GenerateName(peaDefinition PeaDefinition) string
}

type PeaPreparationError

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

func NewPeaPreparationError

func NewPeaPreparationError(peaName string, message string) PeaPreparationError

func (PeaPreparationError) Error

func (error PeaPreparationError) Error() string

func (PeaPreparationError) GetMessage

func (error PeaPreparationError) GetMessage() string

func (PeaPreparationError) GetPeaName

func (error PeaPreparationError) GetPeaName() string

type PeaProcessor

type PeaProcessor interface {
	BeforePeaInitialization(peaName string, pea interface{}) (interface{}, error)
	AfterPeaInitialization(peaName string, pea interface{}) (interface{}, error)
}

type PeaProcessors

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

func NewPeaProcessors

func NewPeaProcessors() *PeaProcessors

func (*PeaProcessors) AddPeaProcessor

func (p *PeaProcessors) AddPeaProcessor(processor PeaProcessor) error

func (*PeaProcessors) GetProcessors

func (p *PeaProcessors) GetProcessors() []PeaProcessor

func (*PeaProcessors) GetProcessorsCount

func (p *PeaProcessors) GetProcessorsCount() int

func (*PeaProcessors) RemoveAllProcessor

func (p *PeaProcessors) RemoveAllProcessor()

func (*PeaProcessors) RemoveProcessor

func (p *PeaProcessors) RemoveProcessor(processor PeaProcessor)

type PeaScope

type PeaScope string
const (
	SharedScope    PeaScope = "shared"
	PrototypeScope PeaScope = "prototype"
)

type SharedPeaRegistry

type SharedPeaRegistry interface {
	RegisterSharedPea(peaName string, sharedObject interface{}) error
	GetSharedPea(peaName string) interface{}
	ContainsSharedPea(peaName string) bool
	GetSharedPeaNames() []string
	GetSharedPeaCount() int
	GetSharedPeaType(requiredType goo.Type) interface{}
	GetSharedPeasByType(requiredType goo.Type) []interface{}
	GetSharedPeaWithObjectFunc(peaName string, objFunc GetObjectFunc) (interface{}, error)
}

type SimplePeaDefinition

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

func NewSimplePeaDefinition

func NewSimplePeaDefinition(typ goo.Type, options ...SimplePeaDefinitionOption) *SimplePeaDefinition

func (*SimplePeaDefinition) GetPeaType

func (def *SimplePeaDefinition) GetPeaType() goo.Type

func (*SimplePeaDefinition) GetScope

func (def *SimplePeaDefinition) GetScope() PeaScope

func (*SimplePeaDefinition) GetTypeName

func (def *SimplePeaDefinition) GetTypeName() string

type SimplePeaDefinitionOption

type SimplePeaDefinitionOption func(definition *SimplePeaDefinition)

func WithScope

func WithScope(scope PeaScope) SimplePeaDefinitionOption

Jump to

Keyboard shortcuts

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