Class ImageFactoryFactory


  • public class ImageFactoryFactory
    extends Object

    Returns a image factory based on a given type

    Since:
    1.1
    Author:
    Andreas Pointner
    • Method Detail

      • getImageFactory

        public static <T> ImageFactory<T> getImageFactory​(Class<T> type)
        This method uses the ServiceLoader to load all available ImageFactory implementation. Then it checks if the given type matched the type supported by the ImageFactory (ImageFactory.getSupportedType(). If multiple image factories exists, that do return the same supported type, an IllegalStateException with duplicated key, will be raised. If the given type is not supported by any of the loaded factories an IllegalStateException 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 a IllegalStateException will be raised.
        Throws:
        IllegalStateException - if two factories have the same support type or if no factory supports the given type.