Package ipsk.util.services
Class ServicesInspector<S>
- java.lang.Object
-
- ipsk.util.services.ServicesInspector<S>
-
- Direct Known Subclasses:
ServiceDescriptorsInspector
public class ServicesInspector<S> extends java.lang.Object
Inspects classpath for service implementation classes. For instance finds JavaSound AudioFileReader implementations. Note: With JRE7 java.util.ServiceLoader there is an implementation with similar functionality but we need it with JRE5- Author:
- Klaus Jaensch
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_UNIQUE
-
Constructor Summary
Constructors Constructor Description ServicesInspector()
ServicesInspector(java.lang.Class<S> serviceClass)
Create service inspector for interface class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<ServiceDescriptor>
getServiceDescriptors()
java.util.List<ServiceDescriptor>
getServiceDescriptors(java.lang.Class<S> providerClass, java.lang.Class<? extends ServiceDescriptor> serviceDescriptorClass, java.lang.ClassLoader cl, boolean loadImplementationClass)
java.util.List<java.lang.Class<? extends S>>
getServiceImplementorClasses()
java.util.List<java.lang.Class<? extends S>>
getServiceImplementorClasses(boolean ignoreErrors)
java.util.List<java.lang.String>
getServiceImplementorClassnames()
Returns list of class names implementing the service.protected java.util.List<java.lang.String>
getServiceImplementorClassnames(java.lang.String providerClassname)
boolean
isUnique()
static void
main(java.lang.String[] args)
protected java.util.List<java.lang.String>
readServiceImplementorClassnames(java.io.InputStream is)
void
setUnique(boolean unique)
-
-
-
Field Detail
-
DEFAULT_UNIQUE
public static final boolean DEFAULT_UNIQUE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ServicesInspector
public ServicesInspector(java.lang.Class<S> serviceClass)
Create service inspector for interface class.- Parameters:
serviceClass
- service class (same as parameter type S)
-
ServicesInspector
public ServicesInspector()
-
-
Method Detail
-
readServiceImplementorClassnames
protected java.util.List<java.lang.String> readServiceImplementorClassnames(java.io.InputStream is) throws java.io.IOException
- Throws:
java.io.IOException
-
getServiceDescriptors
public java.util.List<ServiceDescriptor> getServiceDescriptors() throws java.io.IOException
- Throws:
java.io.IOException
-
getServiceDescriptors
public java.util.List<ServiceDescriptor> getServiceDescriptors(java.lang.Class<S> providerClass, java.lang.Class<? extends ServiceDescriptor> serviceDescriptorClass, java.lang.ClassLoader cl, boolean loadImplementationClass) throws java.io.IOException
- Throws:
java.io.IOException
-
getServiceImplementorClassnames
public java.util.List<java.lang.String> getServiceImplementorClassnames() throws java.io.IOException
Returns list of class names implementing the service.- Returns:
- list of class names implementing the service
- Throws:
java.io.IOException
-
getServiceImplementorClassnames
protected java.util.List<java.lang.String> getServiceImplementorClassnames(java.lang.String providerClassname) throws java.io.IOException
- Throws:
java.io.IOException
-
getServiceImplementorClasses
public java.util.List<java.lang.Class<? extends S>> getServiceImplementorClasses() throws java.io.IOException, java.lang.ClassNotFoundException
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
getServiceImplementorClasses
public java.util.List<java.lang.Class<? extends S>> getServiceImplementorClasses(boolean ignoreErrors) throws java.io.IOException, java.lang.ClassNotFoundException
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
isUnique
public boolean isUnique()
-
setUnique
public void setUnique(boolean unique)
-
main
public static void main(java.lang.String[] args)
- Parameters:
args
-
-
-