Documentation
¶
Index ¶
- Variables
- type ClassLoader
- type DynamicAccess
- type ReflectiveDynamicAccess
- func (p *ReflectiveDynamicAccess) CreateInstanceByName(name string, args ...interface{}) (ins interface{}, err error)
- func (p *ReflectiveDynamicAccess) CreateInstanceByType(typ reflect.Type, args ...interface{}) (ins interface{}, err error)
- func (p *ReflectiveDynamicAccess) GetClassFor(name string) (reflect.Type, bool)
Constants ¶
This section is empty.
Variables ¶
var ( ErrFailedCreateInstance = errors.New("failed create instance") ErrNotFoundConstructMethod = errors.New("not found construct method") ErrBadActorInitFuncOutNumber = errors.New("the actor init function, result should error or nothing") )
reflective dynamic access errors
var Default = NewClassLoader(nil)
Default default class loader
var ErrorType = reflect.TypeOf((*error)(nil)).Elem()
ErrorType define error type
Functions ¶
This section is empty.
Types ¶
type ClassLoader ¶
type ClassLoader interface { GetParent() ClassLoader LoadClass(name string, v interface{}) FindClass(name interface{}) (reflect.Type, bool) FindLoadedClass(name string) bool }
ClassLoader class loader funtions
func NewClassLoader ¶
func NewClassLoader(parent ClassLoader) ClassLoader
NewClassLoader generate class loader with giving parent class loader
type DynamicAccess ¶
type DynamicAccess interface { // Convenience method which given a Class[_] object and a constructor description will create a new instance of that class. CreateInstanceByType(typ reflect.Type, args ...interface{}) (ins interface{}, err error) // Obtain an object conforming to the type T, which is expected to be instantiated from a class designated by the fully-qualified class name given, where the constructor is selected and invoked according to the args argument. CreateInstanceByName(name string, args ...interface{}) (ins interface{}, err error) // Obtain a Class[_] object loaded with the right class loader (i.e. the one returned by classLoader). GetClassFor(name string) (reflect.Type, bool) }
The DynamicAccess implementation is the class which is used for loading all configurable parts of an actor system (the ReflectiveDynamicAccess is the default implementation). This is an internal facility and users are not expected to encounter it unless they are extending Akka in ways which go beyond simple Extensions.
func NewReflectiveDynamicAccess ¶
func NewReflectiveDynamicAccess(classLoader ClassLoader) DynamicAccess
NewReflectiveDynamicAccess obtain the ReflectiveDynamicAccess
type ReflectiveDynamicAccess ¶
type ReflectiveDynamicAccess struct {
// contains filtered or unexported fields
}
ReflectiveDynamicAccess is the default implementation akka.DynamicAccess
func (*ReflectiveDynamicAccess) CreateInstanceByName ¶
func (p *ReflectiveDynamicAccess) CreateInstanceByName(name string, args ...interface{}) ( ins interface{}, err error)
CreateInstanceByName Obtain an object conforming to the type T, which is expected to be instantiated from a class designated by the fully-qualified class name given, where the constructor is selected and invoked according to the args argument.
func (*ReflectiveDynamicAccess) CreateInstanceByType ¶
func (p *ReflectiveDynamicAccess) CreateInstanceByType(typ reflect.Type, args ...interface{}) ( ins interface{}, err error)
CreateInstanceByType Convenience method which given a Class[_] object and a constructor description will create a new instance of that class.
func (*ReflectiveDynamicAccess) GetClassFor ¶
func (p *ReflectiveDynamicAccess) GetClassFor(name string) (reflect.Type, bool)
GetClassFor Obtain a Class[_] object loaded with the right class loader (i.e. the one returned by classLoader).