模板方法模式
模板方法模式
通过把不变行为搬迁到超类,去除字类中的重复代码来体现优势,
先定义一个抽象类,通用的行为均可在此类中实现:
1 |
|
根据不同的业务实现不同的字类:
1 | public class ConcreteAClass extends AbstractClass{ |
客户端使用:
1 | public static void main(String[] args) { |
模板方法模式提供了一个很好的代码复用的平台。
好想在你的鼻尖 扎个猛子
缺失模块。
1、请确保node版本大于6.2
2、在博客根目录(注意不是yilia根目录)执行以下命令:
npm i hexo-generator-json-content --save
3、在根目录_config.yml里添加配置:
jsonContent:
meta: false
pages: false
posts:
title: true
date: true
path: true
text: false
raw: false
content: false
slug: false
updated: false
comments: false
link: false
permalink: false
excerpt: false
categories: false
tags: true