[hibernate-dev] Evolvement of SPIs
Hardy Ferentschik
hardy at hibernate.org
Mon Apr 2 05:44:21 EDT 2012
On Apr 2, 2012, at 11:16 AM, Emmanuel Bernard wrote:
> What's your definition of an SPI, in the team we have slightly different ones.
>
> In Hibernate search an SPI is targeted at frameworks or hyper advanced user who are willing to integrate or enhance Hibernate Search. Otherwise, they are considered APIs - which includes interfaces you might need to implement like FieldBridge. Hibernate ORM has a different semantic where an API is what the application directly code on.
The HV interpretation of SPI is the same view as in ORM. Imo It makes for a simpler, easier to understand cut between API and SPI.
> For your second question, I have used the idea of an interface combined with an abstract class with success. The interface used by the consumers and the abstract class extended by implementors.
I also think that an abstract class can be beneficial. However, I would not generalize this approach. In the case of the HV interfaces in question we have very simple interfaces
(single method ones) with a very low likelihood that they will change. I don't think that the abstract base class is needed in this case, especially since it forces you to use inheritance.
--Hardy
More information about the hibernate-dev
mailing list