visitor

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

访问者模式

访问者模式可以给一系列对象透明的添加功能,并且把相关代码封装到一个类中。

对象只要预留访问者接口Accept则后期为对象添加功能的时候就不需要改动对象。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalysisVisitor

type AnalysisVisitor struct{}

only for enterprise

func (*AnalysisVisitor) Visit

func (*AnalysisVisitor) Visit(customer Customer)

type Customer

type Customer interface {
	Accept(Visitor)
}

type CustomerCol

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

func (*CustomerCol) Accept

func (c *CustomerCol) Accept(visitor Visitor)

func (*CustomerCol) Add

func (c *CustomerCol) Add(customer Customer)

type EnterpriseCustomer

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

func NewEnterpriseCustomer

func NewEnterpriseCustomer(name string) *EnterpriseCustomer

func (*EnterpriseCustomer) Accept

func (c *EnterpriseCustomer) Accept(visitor Visitor)

type IndividualCustomer

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

func NewIndividualCustomer

func NewIndividualCustomer(name string) *IndividualCustomer

func (*IndividualCustomer) Accept

func (c *IndividualCustomer) Accept(visitor Visitor)

type ServiceRequestVisitor

type ServiceRequestVisitor struct{}

func (*ServiceRequestVisitor) Visit

func (*ServiceRequestVisitor) Visit(customer Customer)

type Visitor

type Visitor interface {
	Visit(Customer)
}

Jump to

Keyboard shortcuts

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