Package org.apache.openjpa.lib.util
Class Services
java.lang.Object
org.apache.openjpa.lib.util.Services
Utility classes to locate services, as defined in the Jar File Specification. Most of the methods in this
class can also be found in the sun.misc.Service class, but since
it is undocumented, we cannot rely on its API.
Service location for a specified interface is done by searching for the
resource /META-INF/services/service.class.name, and
loading the resource.
Methods in this class that do not declare exceptions will never throw
Runtime exceptions: exceptions are silently swallowed and empty array values
are returned.
- Author:
- Marc Prud'hommeaux
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Class[]
getImplementorClasses
(Class serviceClass) static Class[]
getImplementorClasses
(Class serviceClass, ClassLoader loader) static Class[]
getImplementorClasses
(String serviceName) Return an array of Class objects of all known service implementors of the specified class name(as resolved by the current thread's context class loader).static Class[]
getImplementorClasses
(String serviceName, ClassLoader loader) static Class[]
getImplementorClasses
(String serviceName, ClassLoader loader, boolean skipMissing) Return an array of Class objects of all known service implementors of the specified class name, as resolved by the specifiedClassLoader
.static String[]
getImplementors
(Class serviceClass) Return an array of Strings of class names of all known service implementors of the specified interface or class.static String[]
getImplementors
(Class serviceClass, ClassLoader loader) Return an array of Strings of class names of all known service implementors of the specified interface or class.static String[]
getImplementors
(String serviceName) Return an array of Strings of class names of all known service implementors of the specified class name(as resolved by the current thread's context class loader).static String[]
getImplementors
(String serviceName, ClassLoader loader) Return an array of Strings of class names of all known service implementors of the specified class name, as resolved by the specifiedClassLoader
.
-
Constructor Details
-
Services
public Services()
-
-
Method Details
-
getImplementors
Return an array of Strings of class names of all known service implementors of the specified interface or class. -
getImplementors
Return an array of Strings of class names of all known service implementors of the specified interface or class. -
getImplementors
Return an array of Strings of class names of all known service implementors of the specified class name(as resolved by the current thread's context class loader). -
getImplementors
Return an array of Strings of class names of all known service implementors of the specified class name, as resolved by the specifiedClassLoader
. -
getImplementorClasses
-
getImplementorClasses
-
getImplementorClasses
Return an array of Class objects of all known service implementors of the specified class name(as resolved by the current thread's context class loader). -
getImplementorClasses
-
getImplementorClasses
public static Class[] getImplementorClasses(String serviceName, ClassLoader loader, boolean skipMissing) throws ClassNotFoundException Return an array of Class objects of all known service implementors of the specified class name, as resolved by the specifiedClassLoader
.- Parameters:
skipMissing
- if true, then ignore classes that cannot be loaded by the classloader; otherwise, resolution failures will throw aClassNotFoundException
.- Throws:
ClassNotFoundException
-