您的位置:首页 > 教育 > 培训 > 公关公司一般收费标准_网站在哪里购买_线上推广平台哪些好_网文推广怎么做

公关公司一般收费标准_网站在哪里购买_线上推广平台哪些好_网文推广怎么做

2025/9/22 21:04:55 来源:https://blog.csdn.net/liu_chunhai/article/details/143171045  浏览:    关键词:公关公司一般收费标准_网站在哪里购买_线上推广平台哪些好_网文推广怎么做
公关公司一般收费标准_网站在哪里购买_线上推广平台哪些好_网文推广怎么做

一句话,适配器按照客户的需求,    适配当前已有的接口。

目标接口:reqeust()

public interface Target {void request();  //this is client needed interface
}

已有接口:specificRequest

package com.example.adapter;import android.util.Log;public class Adaptee {public void specificRequest(){Log.d ("LIU","that is Adaptee specificRequest");}
}

两者的接口功能是一样的,但是需要将已有的接口 适配成符合客户要求的新接口。

public class Adapter implements Target {private Adaptee adaptee;public Adapter(Adaptee adaptee) {   //对象适配器模式,传入对象,并调用对象的 接口this.adaptee = adaptee;}@Overridepublic void request() {adaptee.specificRequest();}
}

调用实现:

        Adaptee adaptee = new Adaptee();Adapter adapter = new Adapter(adaptee);adapter.request();

结果:

2024-10-22 23:05:26.770 12570-12570/com.example.adapter D/LIU: that is Adaptee specificRequest

参考:百度安全验证

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com