decorator

package
v0.0.0-...-bd8c593 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: MIT Imports: 1 Imported by: 0

README

装饰器模式

装饰器模式的目的是动态扩展现有接口的功能而不更改原有的代码逻辑,能够适配原始的代码,使用组合而不是继承的方式扩展功能。 python中直接使用一个@decorator就实现了装饰器的功能。

另外装饰器和代理模式的结构相似,都可以基于组合实现。但装饰器模式目的是对功能的增强,而代理类是附加与原始功能无关的功能。这点区别我们需要记住。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base64DecodeInputStream

type Base64DecodeInputStream struct {
	FilterInputStream
}

func NewBase64DecodeInputStream

func NewBase64DecodeInputStream(in InputStream) *Base64DecodeInputStream

type Base64EncodeInputStream

type Base64EncodeInputStream struct {
	FilterInputStream
}

func NewBase64EncodeInputStream

func NewBase64EncodeInputStream(in InputStream) *Base64EncodeInputStream

type ByteSaveInput

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

ByteSaveInput才是业务原有的业务逻辑。上述的Base64EncodeInputStream和Base64DecodeInputStream是装饰类,是对原有功能进行增强

type FilterInputStream

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

type InputStream

type InputStream interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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