_7_prototype

package
v0.0.0-...-eb36113 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: Apache-2.0, MIT Imports: 0 Imported by: 0

README

原型模式

原型模式使对象能复制自身,并且暴露到接口中,使客户端面向接口编程时,不知道接口实际对象的情况下生成新的对象。

原型模式配合原型管理器使用,使得客户端在不知道具体类的情况下,通过接口管理器得到新的实例,并且包含部分预设定配置。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cloneable

type Cloneable interface {
	Clone() Cloneable
}

type PrototypeManager

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

func NewPrototypeManager

func NewPrototypeManager() *PrototypeManager

func (*PrototypeManager) Get

func (p *PrototypeManager) Get(name string) Cloneable

func (*PrototypeManager) Set

func (p *PrototypeManager) Set(name string, prototype Cloneable)

Jump to

Keyboard shortcuts

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