Gephi开源学习-API与SPI之困惑

本文解释了Java中API和SPI的区别,API是为实现特定目标提供给程序员调用的接口、类、方法等,而SPI是程序员必须继承或实现的接口、类、方法以达成目标。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天再次开始学习Gephi,导到netbeans中看到API和SPI两个包,google如下:

What is the difference between Service Provider Interface (SPI) and Application Programming Interface (API)?
More specifically, for Java libraries, what makes them an API and/or SPI?
the API is the description of classes/interfaces/methods/... that you call and use to achieve a goal
the SPI is the description of classes/interfaces/methods/... that you extend and implement to achieve a goal
Put differently, the API tells you what a specific class/method does for you and the SPI tells you what you must do to conform.
Sometimes SPI and API overlap. For example in JDBC the Driver class is part of the SPI: If you simply want to use JDBC, you don't need to use it directly, but everyone who implements a JDBC driver must implement that class.
The Connection interface on the other hand is both SPI and API: You use it routinely when you use a JDBC driver and it needs to be implemented by the developer of the JDBC driver。

理解为:

        1.API是为实现某一目标,供程序员调用或使用的一种接口/类/方法......

        2.SPI是为实现某一目标,程序员必须继承或者是实现的接口/类/方法......


附详细解析:http://www.cnblogs.com/happyframework/p/3325560.html 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值