Using the @ProviderFor annotation to simplify the use of SPI's
Abstract
The usage of the Service Provider Interface in Java is a great way to make your program more extensible. However, implementing and distributing such an Interface is error prone.
One of the reasons is that the system depends on naming schemes and text files. The name of an implementation should be put in a text file, located on the classpath in a folder called META-INF/services/<qualified interface name>.
An Open Source project, http://spi.googlecode.com, has been created to simplify the use of Service Providers. This project allows the programmer to use an Annotation, @ProviderFor, to flag a class as an implementation of a certain interface. During compilation, the necessary files are created at the appropriate locations. Also, the class is inspected to see if it follows all rules applicable to Service Providers. Compile time errors will be generated if those rules are broken, assisting the programmer to create more robust code.
Speaker
My name is Roel Spilker. I am a senior software developer at TOPdesk, the Netherlands. During my work I found out that the usage of the Service Provider Interface is not that easy. So I started developing this project.
I work for TOPdesk on a Service Management Tool.