Class ImageFactoryFactory
- java.lang.Object
-
- science.aist.imaging.api.domain.wrapper.implementation.ImageFactoryFactory
-
public class ImageFactoryFactory extends Object
Returns a image factory based on a given type
- Since:
- 1.1
- Author:
- Andreas Pointner
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> ImageFactory<T>
getImageFactory(Class<T> type)
This method uses theServiceLoader
to load all availableImageFactory
implementation.
-
-
-
Method Detail
-
getImageFactory
public static <T> ImageFactory<T> getImageFactory(Class<T> type)
This method uses theServiceLoader
to load all availableImageFactory
implementation. Then it checks if the given type matched the type supported by theImageFactory
(ImageFactory.getSupportedType()
. If multiple image factories exists, that do return the same supported type, anIllegalStateException
with duplicated key, will be raised. If the given type is not supported by any of the loaded factories anIllegalStateException
will be raised.- Type Parameters:
T
- The type of the resulting image factory.- Parameters:
type
- The class of the type of the image factory that should be provided.- Returns:
- If a factory for the type exists, an instance of a suitable
ImageFactory
will be returned. Otherwise aIllegalStateException
will be raised. - Throws:
IllegalStateException
- if two factories have the same support type or if no factory supports the given type.
-
-