gs_bean

package
v1.2.0-rc Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package gs_bean provides the bean definition for the Go-Spring framework.

Index

Constants

View Source
const (
	StatusDeleted   = BeanStatus(-1)   // Bean has been deleted.
	StatusDefault   = BeanStatus(iota) // Default status of the bean.
	StatusResolving                    // Bean is being resolved.
	StatusResolved                     // Bean has been resolved.
	StatusCreating                     // Bean is being created.
	StatusCreated                      // Bean has been created.
	StatusWired                        // Bean has been wired.
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BeanDefinition

type BeanDefinition struct {
	*BeanMetadata
	*BeanRuntime
}

BeanDefinition contains both metadata and runtime information of a bean.

func NewBean

func NewBean(t reflect.Type, v reflect.Value, f gs.Callable, name string) *BeanDefinition

NewBean creates a new bean definition.

func (*BeanDefinition) Callable

func (d *BeanDefinition) Callable() gs.Callable

Callable returns the callable for the bean.

func (*BeanDefinition) SetCondition

func (d *BeanDefinition) SetCondition(conditions ...gs.Condition)

SetCondition adds a condition to the list of conditions for the bean.

func (*BeanDefinition) SetConfiguration

func (d *BeanDefinition) SetConfiguration(param ...gs.ConfigurationParam)

SetConfiguration sets the configuration flag and parameters for the bean.

func (*BeanDefinition) SetDependsOn

func (d *BeanDefinition) SetDependsOn(selectors ...gs.BeanSelectorInterface)

SetDependsOn sets the list of dependencies for the bean.

func (*BeanDefinition) SetDestroy

func (d *BeanDefinition) SetDestroy(fn gs.BeanDestroyFunc)

SetDestroy sets the destruction function for the bean.

func (*BeanDefinition) SetExport

func (d *BeanDefinition) SetExport(exports ...reflect.Type)

SetExport sets the exported interfaces for the bean.

func (*BeanDefinition) SetFileLine

func (d *BeanDefinition) SetFileLine(file string, line int)

SetFileLine sets the file and line number for the bean.

func (*BeanDefinition) SetInit

func (d *BeanDefinition) SetInit(fn gs.BeanInitFunc)

SetInit sets the initialization function for the bean.

func (*BeanDefinition) SetName

func (d *BeanDefinition) SetName(name string)

SetName sets the name of the bean.

func (*BeanDefinition) SetRefreshable

func (d *BeanDefinition) SetRefreshable(tag string)

SetRefreshable sets the refreshable flag and tag for the bean.

func (*BeanDefinition) Status

func (d *BeanDefinition) Status() BeanStatus

Status returns the current status of the bean.

func (*BeanDefinition) String

func (d *BeanDefinition) String() string

String returns a string representation of the bean.

func (*BeanDefinition) TypeAndName

func (d *BeanDefinition) TypeAndName() (reflect.Type, string)

TypeAndName returns the type and name of the bean.

type BeanMetadata

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

BeanMetadata holds the metadata information of a bean.

func (*BeanMetadata) Conditions

func (d *BeanMetadata) Conditions() []gs.Condition

Conditions returns the list of conditions for the bean.

func (*BeanMetadata) ConfigurationBean

func (d *BeanMetadata) ConfigurationBean() bool

ConfigurationBean returns whether the bean is a configuration bean.

func (*BeanMetadata) ConfigurationParam

func (d *BeanMetadata) ConfigurationParam() gs.ConfigurationParam

ConfigurationParam returns the configuration parameters for the bean.

func (*BeanMetadata) DependsOn

func (d *BeanMetadata) DependsOn() []gs.BeanSelectorInterface

DependsOn returns the list of dependencies for the bean.

func (*BeanMetadata) Destroy

func (d *BeanMetadata) Destroy() gs.BeanDestroyFunc

Destroy returns the destruction function of the bean.

func (*BeanMetadata) Exports

func (d *BeanMetadata) Exports() []reflect.Type

Exports returns the list of exported types for the bean.

func (*BeanMetadata) FileLine

func (d *BeanMetadata) FileLine() (string, int)

FileLine returns the file and line number for the bean.

func (*BeanMetadata) Init

func (d *BeanMetadata) Init() gs.BeanInitFunc

Init returns the initialization function of the bean.

func (*BeanMetadata) RefreshTag

func (d *BeanMetadata) RefreshTag() string

RefreshTag returns the refresh tag of the bean.

func (*BeanMetadata) Refreshable

func (d *BeanMetadata) Refreshable() bool

Refreshable returns whether the bean is refreshable.

func (*BeanMetadata) SetStatus

func (d *BeanMetadata) SetStatus(status BeanStatus)

SetStatus sets the current status of the bean.

type BeanRuntime

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

BeanRuntime holds runtime information about the bean.

func (*BeanRuntime) Callable

func (d *BeanRuntime) Callable() gs.Callable

Callable returns the callable for the bean.

func (*BeanRuntime) Interface

func (d *BeanRuntime) Interface() interface{}

Interface returns the underlying value of the bean.

func (*BeanRuntime) Name

func (d *BeanRuntime) Name() string

Name returns the name of the bean.

func (*BeanRuntime) Status

func (d *BeanRuntime) Status() BeanStatus

Status returns the current status of the bean.

func (*BeanRuntime) String

func (d *BeanRuntime) String() string

String returns a string representation of the bean.

func (*BeanRuntime) Type

func (d *BeanRuntime) Type() reflect.Type

Type returns the type of the bean.

func (*BeanRuntime) Value

func (d *BeanRuntime) Value() reflect.Value

Value returns the value of the bean as reflect.Value.

type BeanStatus

type BeanStatus int8

BeanStatus represents the different lifecycle statuses of a bean.

func (BeanStatus) String

func (status BeanStatus) String() string

String returns a human-readable string of the bean status.

Jump to

Keyboard shortcuts

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