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

扁平式网站模板wordpress怎么删除目录

扁平式网站模板,wordpress怎么删除目录,百度首页排名代发,关于网站建设的基础知识实现一个简单的文本处理系统。 在这个系统中#xff0c;我们将定义不同类型的文本处理策略#xff0c;比如大小写转换、添加前缀后缀等#xff0c;并使用工厂模式来管理这些策略。 1 定义一个枚举来标识不同的文本处理类型 public enum TextProcessTypeEnum {UPPER_CASE,LO…实现一个简单的文本处理系统。 在这个系统中我们将定义不同类型的文本处理策略比如大小写转换、添加前缀后缀等并使用工厂模式来管理这些策略。 1 定义一个枚举来标识不同的文本处理类型 public enum TextProcessTypeEnum {UPPER_CASE,LOWER_CASE,PREFIX_SUFFIX// 可以继续添加更多的文本处理类型 } 2 定义一个策略接口所有的文本处理策略都将实现这个接口 public interface TextProcessHandler {public String process(String txt);public TextProcessTypeEnum getHandlerType(); } 3 实现几个具体的策略类 import org.springframework.stereotype.Service;Service public class UpperCaseHandler implements TextProcessHandler {Overridepublic String process(String txt) {return txt.toUpperCase();}Overridepublic TextProcessTypeEnum getHandlerType() {return TextProcessTypeEnum.UPPER_CASE;} }Service public class LowerCaseHandler implements TextProcessHandler {Overridepublic String process(String txt) {return txt.toLowerCase();}Overridepublic TextProcessTypeEnum getHandlerType() {return TextProcessTypeEnum.LOWER_CASE;} }Service NoArgsConstructor public class PrefixSuffixHandler implements TextProcessHandler {Value(start--)private String prefix;Value(--end)private String suffix;public PrefixSuffixHandler(String prefix, String suffix) {this.prefix prefix;this.suffix suffix;}Overridepublic String process(String txt) {return prefix txt suffix;}Overridepublic TextProcessTypeEnum getHandlerType() {return TextProcessTypeEnum.PREFIX_SUFFIX;} } 4 创建一个工厂类来管理这些策略 import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.HashMap; import java.util.List; import java.util.Map;Component public class TextProcessHandlerFactory implements InitializingBean {Autowiredprivate ListTextProcessHandler textProcessHandlerList;private final MapTextProcessTypeEnum, TextProcessHandler handlerMap new HashMap();Overridepublic void afterPropertiesSet() throws Exception {System.out.println(textProcessHandlerList textProcessHandlerList);for (TextProcessHandler handler : textProcessHandlerList) {handlerMap.put(handler.getHandlerType(), handler);}System.out.println(handlerMap handlerMap);}public TextProcessHandler getHandler(TextProcessTypeEnum typeEnum){return handlerMap.get(typeEnum);} } 5 使用这个工厂来获取相应的处理器并处理文本 SpringBootTest class DemoMvnTest1ApplicationTests {Autowiredprivate TextProcessHandlerFactory factory;Testvoid contextLoads() {TextProcessHandler handler factory.getHandler(TextProcessTypeEnum.UPPER_CASE);System.out.println(handler.process(hello world));System.out.println();handler factory.getHandler(TextProcessTypeEnum.LOWER_CASE);System.out.println(handler.process(HELLO WORLD));System.out.println();handler factory.getHandler(TextProcessTypeEnum.PREFIX_SUFFIX);System.out.println(handler.process(hello world));}}
http://www.w-s-a.com/news/528020/

相关文章:

  • 用三权重的网站做友链有好处没企业年金怎么查询
  • 工行网站跟建设网站区别wordpress加入地图
  • 网站的风格对比信息表广告门
  • 教育网站建设毕业设计说明书门户网站模式
  • 洛阳霞光建设网站html做分模块的网站
  • 域名建议网站wordpress 伪静态html
  • 网站风格化设计方案免费模式营销案例
  • 凤翔网站建设农村建设自己的网站首页
  • 怎样用网站做单笔外贸建筑设计公司合作加盟
  • 建网站买的是什么网站开发三层结构
  • wordpress图纸管理网站2345网址导航智能主版
  • 想调用等三方网站数据该怎么做培训课程
  • 高端营销网站建设wordpress咨询
  • 网站搜索框如何做创业怎么做网站
  • 网站手机版管理链接产品推广找哪家公司
  • vuejs 可做网站吗蜘蛛互联网站建设
  • 沈阳网站备案查询17zwd一起做业网站
  • 石家庄大型公司建站广州设计网站培训学校
  • 如何让百度收录中文域名网站wordpress前台管理评论
  • 铁岭 建筑公司网站 中企动力建设佛山app开发公司
  • 网站开发用的电脑深圳专业网站建设服务
  • 内容营销价值wordpress博客优化插件
  • 最优惠的郑州网站建设淘宝网商城
  • 做封面网站企业网站优化服务商
  • 电子商务网站设计是什么蚌埠铁路建设监理公司网站
  • .name后缀的网站做房产网站多少钱
  • 手机上传网站源码网站app封装怎么做
  • 做的网站放在阿里云网站建设投标书范本
  • 做文化传播公司网站wordpress仿简书
  • 什么网站有题目做西宁网站制作哪里好