org.apache.commons.classscan.util
Class ServiceVisitor<T>

java.lang.Object
  extended by org.apache.commons.classscan.util.ServiceVisitor<T>
Type Parameters:
T - The type of the provider

public abstract class ServiceVisitor<T>
extends Object

Visit the provider instances specified in the META-INF/services directories


Constructor Summary
ServiceVisitor()
           
 
Method Summary
protected abstract  boolean visit(T serviceProvider)
          The callback method which is invoked upon finding a service provider
 void visitProviders(Class<T> serviceInterface, ClassLoader classLoader)
          Visit the service provider available for the given interface and ClassLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceVisitor

public ServiceVisitor()
Method Detail

visitProviders

public void visitProviders(Class<T> serviceInterface,
                           ClassLoader classLoader)
Visit the service provider available for the given interface and ClassLoader

Parameters:
serviceInterface - The interface of the service
classLoader - The ClassLoader which will load the service

visit

protected abstract boolean visit(T serviceProvider)
The callback method which is invoked upon finding a service provider

Parameters:
serviceProvider - An instance of the service provider
Returns:
true, if additional service providers desired; false, stop the visiting


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.