_2_adapter

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: 1 Imported by: 0

README

适配器模式

适配器模式用于转换一种接口适配另一种接口。

实际使用中 Adapter 一般为接口,并且使用工厂函数生成实例。

在 Adapter 中匿名组合 Adapter 接口,所以Adapter类也拥有 SpecificRequest 实例方法,又因为Go语言中非入侵式接口特征,其实 Adapter 也适配 Adapter 接口。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAdaptee

func NewAdaptee() adapteeImpl

Types

type Adaptee

type Adaptee interface {
	SpecialRequest() string
}

type Target

type Target interface {
	Request() string
}

func NewAdapter

func NewAdapter() Target

Jump to

Keyboard shortcuts

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