Package org.daisy.dotify.api.formatter
Interface FormatterFactory
-
- All Known Implementing Classes:
FormatterFactoryImpl
public interface FormatterFactory
Provides a proxy for creating a formatter implementation. Objects of this class are detected by the formatter factory and their sole purpose is to create instances of a formatter implementation.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Formatter
newFormatter(String locale, String mode)
Creates a new formatter.default void
setCreatedWithSPI()
Informs the implementation that it was discovered and instantiated using information collected from a file within theMETA-INF/services
directory.
-
-
-
Method Detail
-
newFormatter
Formatter newFormatter(String locale, String mode)
Creates a new formatter.- Parameters:
locale
- the localemode
- the mode- Returns:
- returns the new formatter.
-
setCreatedWithSPI
default void setCreatedWithSPI()
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.
-
-