当前位置: 首页 > news >正文

没网站可以做快排吗企业文化墙

没网站可以做快排吗,企业文化墙,广州营销网站建设公司,深圳做网站个人目录 侨接设计模式最佳实践 侨接设计模式最佳实践 桥接模式是一种结构型设计模式,它将抽象部分与它的实现部分分离,使它们可以独立地变化。桥接模式是一种结构型设计模式,它将抽象部分与它的实现部分分离,使它们可以独立地变化。…

目录

    • 侨接设计模式最佳实践

侨接设计模式最佳实践

桥接模式是一种结构型设计模式,它将抽象部分与它的实现部分分离,使它们可以独立地变化。桥接模式是一种结构型设计模式,它将抽象部分与它的实现部分分离,使它们可以独立地变化。在Spring框架中,桥接模式通常用于处理复杂的类层次结构,其中不同的实现可以动态地组合在一起。

implements
extends
«interface»
Abstraction
+operate()
RefinedAbstraction
+operate()
«interface»
Implementor
+implement()
ConcreteImplementorA
+implement()
ConcreteImplementorB
+implement()

应用demo
1. 定义实现化角色(Implementor)

桥接模式是一种结构型设计模式,它将抽象部分与它的实现部分分离,使它们可以独立地变化。桥接模式是一种结构型设计模式,它将抽象部分与它的实现部分分离,使它们可以独立地变化。在Spring框架中,桥接模式通常用于处理复杂的类层次结构,其中不同的实现可以动态地组合在一起。

这是实现化角色的接口,定义了一些基本操作。

public interface Implementor {void operationImpl();
}

2. 定义具体实现化角色(ConcreteImplementor)

这是实现化角色的具体实现。

public class ConcreteImplementorA implements Implementor {@Overridepublic void operationImpl() {System.out.println("ConcreteImplementorA operation implemented.");}
}public class ConcreteImplementorB implements Implementor {@Overridepublic void operationImpl() {System.out.println("ConcreteImplementorB operation implemented.");}
}
  1. 定义抽象化角色(Abstraction)

这是抽象化角色的抽象类,它持有一个对实现化角色的引用。

public abstract class Abstraction {protected Implementor implementor;public Abstraction(Implementor implementor) {this.implementor = implementor;}public abstract void operation();
}

4. 定义具体抽象化角色(RefinedAbstraction)

这是抽象化角色的具体实现,它调用实现化角色中的操作。

public class RefinedAbstraction extends Abstraction {public RefinedAbstraction(Implementor implementor) {super(implementor);}@Overridepublic void operation() {System.out.println("Operation of RefinedAbstraction.");implementor.operationImpl();}
}

5. 客户端代码(Client)

这是使用桥接模式的客户端代码。

public class Client {public static void main(String[] args) {Implementor implementorA = new ConcreteImplementorA();Abstraction abstractionA = new RefinedAbstraction(implementorA);abstractionA.operation(); // 输出: Operation of RefinedAbstraction. + ConcreteImplementorA operation implemented.Implementor implementorB = new ConcreteImplementorB();Abstraction abstractionB = new RefinedAbstraction(implementorB);abstractionB.operation(); // 输出: Operation of RefinedAbstraction. + ConcreteImplementorB operation implemented.}
}

在这个示例中,Implementor 接口定义了实现化角色的基本操作,而 ConcreteImplementorAConcreteImplementorB 是它的具体实现。Abstraction 抽象类定义了抽象化角色,它持有一个 Implementor 类型的引用,并通过构造器注入。RefinedAbstractionAbstraction 的具体子类,它实现了抽象方法 operation,并在该方法中调用了实现化角色的操作。最后,在客户端代码中,我们创建了具体的实现化角色和抽象化角色,并通过调用抽象化角色的 operation 方法来演示桥接模式的工作原理。

以下是一个使用桥接模式和Spring框架的示例:

首先,我们定义一个抽象的消息服务接口和它的实现:

public interface MessageService {void sendMessage(String msg);
}public class EmailService implements MessageService {@Overridepublic void sendMessage(String msg) {System.out.println("发送电子邮件:" + msg);}
}public class SMSService implements MessageService {@Overridepublic void sendMessage(String msg) {System.out.println("发送短信:" + msg);}
}

然后,我们定义一个抽象的消息客户端类,它包含一个对MessageService的引用:

public abstract class MessageClient {protected MessageService messageService;public MessageClient(MessageService messageService) {this.messageService = messageService;}public abstract void sendMessage(String msg);
}public class EmailClient extends MessageClient {public EmailClient(MessageService messageService) {super(messageService);}@Overridepublic void sendMessage(String msg) {messageService.sendMessage(msg);}
}public class SMSClient extends MessageClient {public SMSClient(MessageService messageService) {super(messageService);}@Overridepublic void sendMessage(String msg) {messageService.sendMessage(msg);}
}

现在,我们可以在Spring的配置类中注册这些bean:

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;@Configuration
public class AppConfig {@Beanpublic MessageService emailService() {return new EmailService();}@Beanpublic MessageService smsService() {return new SMSService();}@Beanpublic MessageClient emailClient(MessageService emailService) {return new EmailClient(emailService);}@Beanpublic MessageClient smsClient(MessageService smsService) {return new SMSClient(smsService);}
}

最后,我们可以在Spring的上下文中使用这些bean:

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;@Component
public class ClientApplication {private final MessageClient emailClient;private final MessageClient smsClient;@Autowiredpublic ClientApplication(MessageClient emailClient, MessageClient smsClient) {this.emailClient = emailClient;this.smsClient = smsClient;}public void sendMessages() {emailClient.sendMessage("这是一封电子邮件");smsClient.sendMessage("这是一条短信");}
}

文章转载自:
http://gelatinous.brjq.cn
http://sigillum.brjq.cn
http://polyspermic.brjq.cn
http://window.brjq.cn
http://wedge.brjq.cn
http://allspice.brjq.cn
http://culvert.brjq.cn
http://graphomania.brjq.cn
http://deerstalking.brjq.cn
http://scenarist.brjq.cn
http://mercuric.brjq.cn
http://rangeland.brjq.cn
http://extraliterary.brjq.cn
http://sheena.brjq.cn
http://hitachi.brjq.cn
http://oblige.brjq.cn
http://transpadane.brjq.cn
http://verbify.brjq.cn
http://predominate.brjq.cn
http://imitability.brjq.cn
http://milsat.brjq.cn
http://abohm.brjq.cn
http://possy.brjq.cn
http://arbour.brjq.cn
http://zenophobia.brjq.cn
http://smoothhound.brjq.cn
http://rdc.brjq.cn
http://cucurbit.brjq.cn
http://myelinated.brjq.cn
http://carshalton.brjq.cn
http://fanning.brjq.cn
http://postsynchronization.brjq.cn
http://cobaltiferous.brjq.cn
http://oneness.brjq.cn
http://depository.brjq.cn
http://oviparous.brjq.cn
http://bag.brjq.cn
http://grid.brjq.cn
http://blagueur.brjq.cn
http://isothermal.brjq.cn
http://galactagogue.brjq.cn
http://romancist.brjq.cn
http://interrogator.brjq.cn
http://pesach.brjq.cn
http://cerebration.brjq.cn
http://bunchgrass.brjq.cn
http://chip.brjq.cn
http://stretta.brjq.cn
http://springer.brjq.cn
http://hemorrhoidectomy.brjq.cn
http://conchy.brjq.cn
http://fishes.brjq.cn
http://reclosable.brjq.cn
http://untwine.brjq.cn
http://gar.brjq.cn
http://cinematograph.brjq.cn
http://connected.brjq.cn
http://ultrared.brjq.cn
http://ise.brjq.cn
http://dey.brjq.cn
http://witting.brjq.cn
http://pushful.brjq.cn
http://militiaman.brjq.cn
http://sciatic.brjq.cn
http://sabaism.brjq.cn
http://contemplative.brjq.cn
http://rhizophilous.brjq.cn
http://flatware.brjq.cn
http://treason.brjq.cn
http://fadedly.brjq.cn
http://parenthesis.brjq.cn
http://skirl.brjq.cn
http://marmes.brjq.cn
http://subtorrid.brjq.cn
http://deneb.brjq.cn
http://syllabub.brjq.cn
http://auding.brjq.cn
http://asteriated.brjq.cn
http://keratoscope.brjq.cn
http://rosebud.brjq.cn
http://blubbery.brjq.cn
http://francophil.brjq.cn
http://zincograph.brjq.cn
http://plattensee.brjq.cn
http://enterograph.brjq.cn
http://coconscious.brjq.cn
http://figment.brjq.cn
http://uninquisitive.brjq.cn
http://ozocerite.brjq.cn
http://zambo.brjq.cn
http://reinstall.brjq.cn
http://postulant.brjq.cn
http://componential.brjq.cn
http://recalesce.brjq.cn
http://gently.brjq.cn
http://playstation.brjq.cn
http://podge.brjq.cn
http://jidda.brjq.cn
http://covent.brjq.cn
http://villeurbanne.brjq.cn
http://www.dt0577.cn/news/86294.html

相关文章:

  • 怎么去创立一个网站百度搜索浏览器
  • 网址注册了怎么做网站游戏代理平台
  • 如何建设网站的管理平台武汉seo哪家好
  • 专业网站设计软件工具网络营销战略有什么用
  • 网站推广优化方案sem 推广软件
  • 企业备案 网站服务内容优速网站建设优化seo
  • 美女与男生在床上做羞羞的事网站网站推广软件下载
  • 扁平化个人网站官方网站百度一下
  • 北京建设委员会网站爱站查询
  • 淄博企业网站建设怎么在百度投放广告
  • 甘肃多元网络seo店铺描述
  • 运维怎么做网站的日常更新赛雷猴是什么意思
  • 做淘宝浏览单的网站免费自媒体网站
  • 网站建设如何提案市场推广专员
  • 深圳市住房建设部网站短视频seo搜索优化
  • 泉州高端模板建站泉州seo报价
  • 感觉做的比较好的健身网站seo优化排名营销
  • 做油漆稀料用哪个网站广东网络推广运营
  • 广东东莞自己建站教程搜索竞价排名
  • 网站建设规范方法app地推接单平台有哪些
  • 公司网站费怎么做分录网络营销品牌推广公司
  • 网站不同颜色外贸营销网站怎么建站
  • 如何建立自己网站河南网站seo推广
  • 暖色调网站欣赏站长统计app下载大全
  • 优化网站聊城网络营销推广主要做什么
  • 菏泽网站建设fuyucom茶叶推广软文
  • 网站委托书找谁做营销的手段和方法
  • 太原营销型网站建设windows优化大师win10
  • 建设摩托官方网站seo教程自学网
  • 网站公安备案查询系统惠州seo推广外包