org.daisy.dotify.api.text.Integer2TextFactoryService Maven / Gradle / Ivy
package org.daisy.dotify.api.text;
import java.util.Collection;
/**
*
* Provides an interface for a Integer2TextFactory service. The purpose of this
* interface is to expose an implementation of a Integer2TextFactory as a
* service.
*
*
*
* To comply with this interface, an implementation must be thread safe and
* address both the possibility that only a single instance is created and used
* throughout and that new instances are created as desired.
*
*
* @author Joel Håkansson
*/
public interface Integer2TextFactoryService {
/**
* Returns true if this instance can create instances for the specified
* locale.
*
* @param locale a valid locale as defined by IETF RFC 3066
* @return returns true if the specified locale is supported, false
* otherwise
*/
public boolean supportsLocale(String locale);
/**
* Returns a list of supported locales as defined by IETF RFC 3066.
*
* @return returns a list of locales
*/
public Collection listLocales();
/**
* Creates a new integer to text factory.
*
* @return returns a new factory
*/
public Integer2TextFactory newFactory();
/**
* Informs the implementation that it was discovered and instantiated using
* information collected from a file within the META-INF/services
directory.
* In other words, it was created using SPI (service provider interfaces).
*
* This information, in turn, enables the implementation to use the same mechanism
* to set dependencies as needed.
*
* If this information is not given, an implementation
* should avoid using SPIs and instead use
* declarative services
* for dependency injection as specified by OSGi. Note that this also applies to
* several newInstance() methods in the Java API.
*
* The class that created an instance with SPI must call this method before
* putting it to use.
*/
public default void setCreatedWithSPI() {
}
}