设计模式-装饰者模式

一、基本定义

装饰(Decorator)模式又叫做包装模式,其功能是动态地给一个对象添加一些额外的职责。就增加功能来说,装饰模式相比生成子类更为灵活,是继承关系的一个替换方案。装饰模式可以在不创造更多子类的情况下,将对象的功能加以扩展。装饰模式把客户端的调用委派到被装饰类。

二、代码实现

1.创建被修饰的基类(接口)
public interface IComment {
    //定义接口方法
    void print();
}
2.创建被修饰类的实现类
public class comment implements IComment {
    @Override
    public void print() {
        System.out.println("被修饰类的类的实现类。。。");
    }
}
3.创建修饰类的基类(抽象类)
//修饰类基类对象
public abstract class AbstarctComment implements IComment{
    //一定要引入基类对象
    private IComment comment;
    //构造函数
    public AbstarctComment(IComment comment){
        this.comment=comment;
    }
    //复写接口中的方法
    @Override
    public void print() {
        comment.print();
    }
}
image.png
4.写修饰类的子类
public class b1 extends AbstarctComment {

    public b1(IComment comment) {
        super(comment);
    }

    @Override
    public void print() {
        //调用父类的方法,其实是为了调用被修饰类基类的实现类方法
        super.print();
        //调用自己的处理的方法
        this.myPrint();
    }
    void myPrint(){
        System.out.println("修饰类b1的操作...");
    }
}
说明

这里子类为什么要用super(comment)调用父类构造?
因为如果子类没有显示调用父类构造器,则会自动调用父类默认构造器,如果父类没有默认的无参构造器,则子类需要显示调用父类构造函数,并且super()语句必须写在构造函数中第一条,否则编译无法通过。

5.编写测试类
public class test{
    public static void main(String[] args){
        //创建被修饰类对象
        IComment out=new comment();
        //创建修饰类对象
        b1 b=new b1(out);
        b.print();
    }
}
6.运行结果
"C:\Program Files\Java\jdk1.8.0_121\bin\java" -server -XX:PermSize=1536M -XX:MaxPermSize=1536m "-javaagent:D:\soft\idea\IntelliJ IDEA 2017.2.2\lib\idea_rt.jar=2916:D:\soft\idea\IntelliJ IDEA 2017.2.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_121\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\rt.jar;D:\git\fang-newhouse\web\fang2b-api\target\test-classes;D:\git\fang-newhouse\web\fang2b-api\target\classes;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.1.3.RELEASE\spring-boot-starter-web-2.1.3.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter\2.1.3.RELEASE\spring-boot-starter-2.1.3.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.1.3.RELEASE\spring-boot-starter-logging-2.1.3.RELEASE.jar;C:\Users\User\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\User\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\User\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.11.2\log4j-to-slf4j-2.11.2.jar;C:\Users\User\.m2\repository\org\apache\logging\log4j\log4j-api\2.11.2\log4j-api-2.11.2.jar;C:\Users\User\.m2\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;C:\Users\User\.m2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;C:\Users\User\.m2\repository\org\yaml\snakeyaml\1.23\snakeyaml-1.23.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.1.3.RELEASE\spring-boot-starter-json-2.1.3.RELEASE.jar;C:\Users\User\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.8\jackson-datatype-jdk8-2.9.8.jar;C:\Users\User\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.8\jackson-datatype-jsr310-2.9.8.jar;C:\Users\User\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.8\jackson-module-parameter-names-2.9.8.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.1.3.RELEASE\spring-boot-starter-tomcat-2.1.3.RELEASE.jar;C:\Users\User\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.16\tomcat-embed-core-9.0.16.jar;C:\Users\User\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.16\tomcat-embed-el-9.0.16.jar;C:\Users\User\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.16\tomcat-embed-websocket-9.0.16.jar;C:\Users\User\.m2\repository\org\hibernate\validator\hibernate-validator\6.0.14.Final\hibernate-validator-6.0.14.Final.jar;C:\Users\User\.m2\repository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;C:\Users\User\.m2\repository\com\fasterxml\classmate\1.4.0\classmate-1.4.0.jar;C:\Users\User\.m2\repository\org\springframework\spring-web\5.1.5.RELEASE\spring-web-5.1.5.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-beans\5.1.5.RELEASE\spring-beans-5.1.5.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-webmvc\5.1.5.RELEASE\spring-webmvc-5.1.5.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-aop\5.1.5.RELEASE\spring-aop-5.1.5.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-context\5.1.5.RELEASE\spring-context-5.1.5.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-expression\5.1.5.RELEASE\spring-expression-5.1.5.RELEASE.jar;D:\git\fang-newhouse\web\normal\target\classes;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-aop\2.1.3.RELEASE\spring-boot-starter-aop-2.1.3.RELEASE.jar;C:\Users\User\.m2\repository\org\aspectj\aspectjweaver\1.9.2\aspectjweaver-1.9.2.jar;D:\git\fang-newhouse\lib\common\target\classes;C:\Users\User\.m2\repository\net\sourceforge\jtds\jtds\1.3.1\jtds-1.3.1.jar;C:\Users\User\.m2\repository\com\belerweb\pinyin4j\2.5.1\pinyin4j-2.5.1.jar;C:\Users\User\.m2\repository\uk\com\robust-it\cloning\1.9.11\cloning-1.9.11.jar;C:\Users\User\.m2\repository\org\objenesis\objenesis\2.6\objenesis-2.6.jar;C:\Users\User\.m2\repository\com\squareup\okhttp3\okhttp\3.12.1\okhttp-3.12.1.jar;C:\Users\User\.m2\repository\com\squareup\okio\okio\1.15.0\okio-1.15.0.jar;C:\Users\User\.m2\repository\com\squareup\okhttp3\logging-interceptor\3.12.1\logging-interceptor-3.12.1.jar;C:\Users\User\.m2\repository\org\apache\commons\commons-lang3\3.8.1\commons-lang3-3.8.1.jar;C:\Users\User\.m2\repository\com\google\guava\guava\27.0.1-jre\guava-27.0.1-jre.jar;C:\Users\User\.m2\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;C:\Users\User\.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;C:\Users\User\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;C:\Users\User\.m2\repository\org\checkerframework\checker-qual\2.5.2\checker-qual-2.5.2.jar;C:\Users\User\.m2\repository\com\google\errorprone\error_prone_annotations\2.2.0\error_prone_annotations-2.2.0.jar;C:\Users\User\.m2\repository\com\google\j2objc\j2objc-annotations\1.1\j2objc-annotations-1.1.jar;C:\Users\User\.m2\repository\org\codehaus\mojo\animal-sniffer-annotations\1.17\animal-sniffer-annotations-1.17.jar;C:\Users\User\.m2\repository\com\fasterxml\jackson\module\jackson-module-kotlin\2.9.8\jackson-module-kotlin-2.9.8.jar;C:\Users\User\.m2\repository\org\jdom\jdom2\2.0.6\jdom2-2.0.6.jar;C:\Users\User\.m2\repository\joda-time\joda-time\2.10.1\joda-time-2.10.1.jar;C:\Users\User\.m2\repository\io\springfox\springfox-swagger2\2.9.2\springfox-swagger2-2.9.2.jar;C:\Users\User\.m2\repository\io\swagger\swagger-annotations\1.5.20\swagger-annotations-1.5.20.jar;C:\Users\User\.m2\repository\io\swagger\swagger-models\1.5.20\swagger-models-1.5.20.jar;C:\Users\User\.m2\repository\io\springfox\springfox-spi\2.9.2\springfox-spi-2.9.2.jar;C:\Users\User\.m2\repository\io\springfox\springfox-core\2.9.2\springfox-core-2.9.2.jar;C:\Users\User\.m2\repository\net\bytebuddy\byte-buddy\1.9.10\byte-buddy-1.9.10.jar;C:\Users\User\.m2\repository\io\springfox\springfox-schema\2.9.2\springfox-schema-2.9.2.jar;C:\Users\User\.m2\repository\io\springfox\springfox-swagger-common\2.9.2\springfox-swagger-common-2.9.2.jar;C:\Users\User\.m2\repository\io\springfox\springfox-spring-web\2.9.2\springfox-spring-web-2.9.2.jar;C:\Users\User\.m2\repository\org\springframework\plugin\spring-plugin-core\1.2.0.RELEASE\spring-plugin-core-1.2.0.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\plugin\spring-plugin-metadata\1.2.0.RELEASE\spring-plugin-metadata-1.2.0.RELEASE.jar;C:\Users\User\.m2\repository\org\mapstruct\mapstruct\1.2.0.Final\mapstruct-1.2.0.Final.jar;C:\Users\User\.m2\repository\io\springfox\springfox-swagger-ui\2.9.2\springfox-swagger-ui-2.9.2.jar;C:\Users\User\.m2\repository\org\projectlombok\lombok\1.18.6\lombok-1.18.6.jar;C:\Users\User\.m2\repository\org\springframework\spring-context-support\5.1.5.RELEASE\spring-context-support-5.1.5.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-mail\2.1.3.RELEASE\spring-boot-starter-mail-2.1.3.RELEASE.jar;C:\Users\User\.m2\repository\com\sun\mail\javax.mail\1.6.2\javax.mail-1.6.2.jar;C:\Users\User\.m2\repository\javax\activation\activation\1.1\activation-1.1.jar;C:\Users\User\.m2\repository\org\apache\httpcomponents\httpmime\4.5.7\httpmime-4.5.7.jar;C:\Users\User\.m2\repository\commons-codec\commons-codec\1.11\commons-codec-1.11.jar;C:\Users\User\.m2\repository\com\itextpdf\itextpdf\5.5.9\itextpdf-5.5.9.jar;C:\Users\User\.m2\repository\com\itextpdf\tool\xmlworker\5.5.9\xmlworker-5.5.9.jar;C:\Users\User\.m2\repository\com\itextpdf\itext-asian\5.2.0\itext-asian-5.2.0.jar;C:\Users\User\.m2\repository\org\xhtmlrenderer\flying-saucer-pdf-itext5\9.0.3\flying-saucer-pdf-itext5-9.0.3.jar;C:\Users\User\.m2\repository\org\xhtmlrenderer\flying-saucer-core\9.0.3\flying-saucer-core-9.0.3.jar;C:\Users\User\.m2\repository\org\apache\pdfbox\pdfbox\2.0.1\pdfbox-2.0.1.jar;C:\Users\User\.m2\repository\org\apache\pdfbox\fontbox\2.0.1\fontbox-2.0.1.jar;C:\Users\User\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-devtools\2.1.3.RELEASE\spring-boot-devtools-2.1.3.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot\2.1.3.RELEASE\spring-boot-2.1.3.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.1.3.RELEASE\spring-boot-autoconfigure-2.1.3.RELEASE.jar;D:\git\fang-newhouse\lib\database\target\classes;C:\Users\User\.m2\repository\com\alibaba\druid-spring-boot-starter\1.1.10\druid-spring-boot-starter-1.1.10.jar;C:\Users\User\.m2\repository\com\alibaba\druid\1.1.10\druid-1.1.10.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\2.1.3.RELEASE\spring-boot-starter-jdbc-2.1.3.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-jdbc\5.1.5.RELEASE\spring-jdbc-5.1.5.RELEASE.jar;C:\Users\User\.m2\repository\com\google\code\gson\gson\2.8.5\gson-2.8.5.jar;C:\Users\User\.m2\repository\mysql\mysql-connector-java\8.0.15\mysql-connector-java-8.0.15.jar;C:\Users\User\.m2\repository\com\microsoft\sqlserver\mssql-jdbc\6.4.0.jre8\mssql-jdbc-6.4.0.jre8.jar;D:\git\fang-newhouse\lib\redis\target\classes;C:\Users\User\.m2\repository\org\msgpack\msgpack-core\0.8.16\msgpack-core-0.8.16.jar;C:\Users\User\.m2\repository\org\msgpack\jackson-dataformat-msgpack\0.8.16\jackson-dataformat-msgpack-0.8.16.jar;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-starter-data-redis\2.1.3.RELEASE\spring-boot-starter-data-redis-2.1.3.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\data\spring-data-redis\2.1.5.RELEASE\spring-data-redis-2.1.5.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\data\spring-data-keyvalue\2.1.5.RELEASE\spring-data-keyvalue-2.1.5.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\data\spring-data-commons\2.1.5.RELEASE\spring-data-commons-2.1.5.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-oxm\5.1.5.RELEASE\spring-oxm-5.1.5.RELEASE.jar;C:\Users\User\.m2\repository\io\lettuce\lettuce-core\5.1.4.RELEASE\lettuce-core-5.1.4.RELEASE.jar;C:\Users\User\.m2\repository\io\netty\netty-common\4.1.33.Final\netty-common-4.1.33.Final.jar;C:\Users\User\.m2\repository\io\netty\netty-handler\4.1.33.Final\netty-handler-4.1.33.Final.jar;C:\Users\User\.m2\repository\io\netty\netty-buffer\4.1.33.Final\netty-buffer-4.1.33.Final.jar;C:\Users\User\.m2\repository\io\netty\netty-codec\4.1.33.Final\netty-codec-4.1.33.Final.jar;C:\Users\User\.m2\repository\io\netty\netty-transport\4.1.33.Final\netty-transport-4.1.33.Final.jar;C:\Users\User\.m2\repository\io\netty\netty-resolver\4.1.33.Final\netty-resolver-4.1.33.Final.jar;C:\Users\User\.m2\repository\io\projectreactor\reactor-core\3.2.6.RELEASE\reactor-core-3.2.6.RELEASE.jar;C:\Users\User\.m2\repository\org\reactivestreams\reactive-streams\1.0.2\reactive-streams-1.0.2.jar;C:\Users\User\.m2\repository\com\ctrip\framework\apollo\apollo-client\1.1.2\apollo-client-1.1.2.jar;C:\Users\User\.m2\repository\com\ctrip\framework\apollo\apollo-core\1.1.2\apollo-core-1.1.2.jar;C:\Users\User\.m2\repository\com\google\inject\guice\4.1.0\guice-4.1.0.jar;C:\Users\User\.m2\repository\javax\inject\javax.inject\1\javax.inject-1.jar;C:\Users\User\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;C:\Users\User\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\git\fang-newhouse\service\order-service\target\classes;C:\Users\User\.m2\repository\org\springframework\cloud\spring-cloud-context\2.1.1.RELEASE\spring-cloud-context-2.1.1.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\security\spring-security-crypto\5.1.4.RELEASE\spring-security-crypto-5.1.4.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-tx\5.1.5.RELEASE\spring-tx-5.1.5.RELEASE.jar;C:\Users\User\.m2\repository\com\github\pagehelper\pagehelper-spring-boot-starter\1.2.10\pagehelper-spring-boot-starter-1.2.10.jar;C:\Users\User\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-starter\1.3.2\mybatis-spring-boot-starter-1.3.2.jar;C:\Users\User\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-autoconfigure\1.3.2\mybatis-spring-boot-autoconfigure-1.3.2.jar;C:\Users\User\.m2\repository\org\mybatis\mybatis\3.4.6\mybatis-3.4.6.jar;C:\Users\User\.m2\repository\org\mybatis\mybatis-spring\1.3.2\mybatis-spring-1.3.2.jar;C:\Users\User\.m2\repository\com\github\pagehelper\pagehelper-spring-boot-autoconfigure\1.2.10\pagehelper-spring-boot-autoconfigure-1.2.10.jar;C:\Users\User\.m2\repository\com\baomidou\mybatis-plus-boot-starter\3.0.7.1\mybatis-plus-boot-starter-3.0.7.1.jar;C:\Users\User\.m2\repository\com\baomidou\mybatis-plus\3.0.7.1\mybatis-plus-3.0.7.1.jar;C:\Users\User\.m2\repository\com\baomidou\mybatis-plus-extension\3.0.7.1\mybatis-plus-extension-3.0.7.1.jar;C:\Users\User\.m2\repository\com\baomidou\mybatis-plus-core\3.0.7.1\mybatis-plus-core-3.0.7.1.jar;C:\Users\User\.m2\repository\com\baomidou\mybatis-plus-annotation\3.0.7.1\mybatis-plus-annotation-3.0.7.1.jar;D:\git\fang-newhouse\model\fang2b-model\target\classes;C:\Users\User\.m2\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;C:\Users\User\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;C:\Users\User\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.9.8\jackson-databind-2.9.8.jar;C:\Users\User\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.9.8\jackson-core-2.9.8.jar;C:\Users\User\.m2\repository\org\codehaus\jackson\jackson-mapper-asl\1.9.13\jackson-mapper-asl-1.9.13.jar;C:\Users\User\.m2\repository\org\codehaus\jackson\jackson-core-asl\1.9.13\jackson-core-asl-1.9.13.jar;D:\git\fang-newhouse\service\store-service\target\classes;C:\Users\User\.m2\repository\javax\servlet\javax.servlet-api\4.0.1\javax.servlet-api-4.0.1.jar;D:\git\fang-newhouse\dao\target\classes;D:\git\fang-newhouse\model\fang2c-model\target\classes;C:\Users\User\.m2\repository\com\github\pagehelper\pagehelper\5.0.0\pagehelper-5.0.0.jar;C:\Users\User\.m2\repository\com\github\jsqlparser\jsqlparser\0.9.5\jsqlparser-0.9.5.jar;D:\git\fang-newhouse\service\pay-service\target\classes;D:\git\fang-newhouse\service\common-service\target\classes;C:\Users\User\.m2\repository\org\springframework\boot\spring-boot-test\2.1.3.RELEASE\spring-boot-test-2.1.3.RELEASE.jar;C:\Users\User\.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\User\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;C:\Users\User\.m2\repository\org\springframework\spring-test\5.0.7.RELEASE\spring-test-5.0.7.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-core\5.1.5.RELEASE\spring-core-5.1.5.RELEASE.jar;C:\Users\User\.m2\repository\org\springframework\spring-jcl\5.1.5.RELEASE\spring-jcl-5.1.5.RELEASE.jar;C:\Users\User\.m2\repository\com\thoughtworks\xstream\xstream\1.4.10\xstream-1.4.10.jar;C:\Users\User\.m2\repository\xmlpull\xmlpull\1.1.3.1\xmlpull-1.1.3.1.jar;C:\Users\User\.m2\repository\xpp3\xpp3_min\1.1.4c\xpp3_min-1.1.4c.jar;C:\Users\User\.m2\repository\com\github\xuwei-k\html2image\0.1.0\html2image-0.1.0.jar;C:\Users\User\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib\1.3.11\kotlin-stdlib-1.3.11.jar;C:\Users\User\.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-common\1.3.11\kotlin-stdlib-common-1.3.11.jar;C:\Users\User\.m2\repository\org\jetbrains\annotations\13.0\annotations-13.0.jar;C:\Users\User\.m2\repository\org\jetbrains\kotlin\kotlin-test\1.3.11\kotlin-test-1.3.11.jar;C:\Users\User\.m2\repository\org\jetbrains\kotlin\kotlin-test-common\1.3.11\kotlin-test-common-1.3.11.jar;C:\Users\User\.m2\repository\org\jetbrains\kotlin\kotlin-reflect\1.3.11\kotlin-reflect-1.3.11.jar;C:\Users\User\.m2\repository\org\sonarsource\scanner\maven\sonar-maven-plugin\3.4.0.905\sonar-maven-plugin-3.4.0.905.jar;C:\Users\User\.m2\repository\org\sonatype\plexus\plexus-sec-dispatcher\1.4\plexus-sec-dispatcher-1.4.jar;C:\Users\User\.m2\repository\org\sonatype\plexus\plexus-cipher\1.4\plexus-cipher-1.4.jar;C:\Users\User\.m2\repository\org\codehaus\plexus\plexus-utils\3.0.22\plexus-utils-3.0.22.jar;C:\Users\User\.m2\repository\org\sonarsource\scanner\api\sonar-scanner-api\2.10.0.1189\sonar-scanner-api-2.10.0.1189.jar;C:\Users\User\.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;C:\Users\User\.m2\repository\commons-net\commons-net\3.3\commons-net-3.3.jar;C:\Users\User\.m2\repository\com\qcloud\cos_api\5.5.1\cos_api-5.5.1.jar;C:\Users\User\.m2\repository\org\apache\httpcomponents\httpclient\4.5.7\httpclient-4.5.7.jar;C:\Users\User\.m2\repository\org\apache\httpcomponents\httpcore\4.4.11\httpcore-4.4.11.jar;C:\Users\User\.m2\repository\org\slf4j\slf4j-log4j12\1.7.25\slf4j-log4j12-1.7.25.jar;C:\Users\User\.m2\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;C:\Users\User\.m2\repository\org\bouncycastle\bcprov-jdk15on\1.59\bcprov-jdk15on-1.59.jar;C:\Users\User\.m2\repository\commons-fileupload\commons-fileupload\1.3.1\commons-fileupload-1.3.1.jar;C:\Users\User\.m2\repository\commons-io\commons-io\2.2\commons-io-2.2.jar;C:\Users\User\.m2\repository\com\alibaba\fastjson\1.2.28\fastjson-1.2.28.jar" test.test
被修饰类的类的实现类。。。
修饰类b1的操作...
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=1536M; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=1536m; support was removed in 8.0

Process finished with exit code 0

你可能感兴趣的:(设计模式-装饰者模式)