Package org.apache.tika.utils
Class ServiceLoaderUtils
- java.lang.Object
 - 
- org.apache.tika.utils.ServiceLoaderUtils
 
 
- 
public class ServiceLoaderUtils extends Object
Service Loading and Ordering related utils 
- 
- 
Constructor Summary
Constructors Constructor Description ServiceLoaderUtils() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> TnewInstance(Class klass, ServiceLoader loader)Loads a class and instantiates it.static <T> TnewInstance(String className)Loads a class and instantiates itstatic <T> TnewInstance(String className, ClassLoader loader)Loads a class and instantiates itstatic <T> voidsortLoadedClasses(List<T> loaded)Sorts a list of loaded classes, so that non-Tika ones come before Tika ones, and otherwise in reverse alphabetical order 
 - 
 
- 
- 
Method Detail
- 
sortLoadedClasses
public static <T> void sortLoadedClasses(List<T> loaded)
Sorts a list of loaded classes, so that non-Tika ones come before Tika ones, and otherwise in reverse alphabetical order 
- 
newInstance
public static <T> T newInstance(String className)
Loads a class and instantiates it- Type Parameters:
 T- service type- Parameters:
 className- service class name- Returns:
 - instance of service
 
 
- 
newInstance
public static <T> T newInstance(String className, ClassLoader loader)
Loads a class and instantiates it- Type Parameters:
 T- service type- Parameters:
 className- service class nameloader- class loader- Returns:
 - instance of service
 
 
- 
newInstance
public static <T> T newInstance(Class klass, ServiceLoader loader)
Loads a class and instantiates it. If the class can be initialized with a ServiceLoader, the ServiceLoader constructor is used. Otherwise, a zero arg newInstance() is called.- Type Parameters:
 T- service type- Parameters:
 klass- class to buildloader- service loader- Returns:
 - instance of service
 
 
 - 
 
 -