private Class clazz;
/**
- * Constructs the factory.
- * @param aClass Interface class of the service to proxy.
+ * Constructs the factory.
+ *
+ * @param aClass
+ * Interface class of the service to proxy.
*/
public ThreadSpecificProxyFactory(Class<T> aClass) {
- if ( !aClass.isInterface() ) {
- throw new IllegalArgumentException("Class " + aClass.getName() + " is not an interface");
+ if (!aClass.isInterface()) {
+ throw new IllegalArgumentException("Class " + aClass.getName() +
+ " is not an interface");
}
clazz = aClass;
}
/**
- * Sets the thread-specific service.
- * @param aService Service, use null value to reset.
+ * Sets the thread-specific service.
+ *
+ * @param aService
+ * Service, use null value to reset.
*/
public void set(T aService) {
svc.set(aService);
}
/**
- * Gets the proxy that delegates to the thread-specific instance set by
+ * Gets the proxy that delegates to the thread-specific instance set by
* {@link #set(Object)}
- * @return Proxy.
+ *
+ * @return Proxy.
*/
public T getProxy() {
InvocationHandler handler = new ThreadSpecificInvocationHandler();
new Class[] { InvocationHandler.class }).newInstance(
new Object[] { handler });
return proxy;
- } catch (Exception e) {
- throw new RuntimeException("Could not create proxy for " + clazz.getName(), e);
+ } catch (Exception e) {
+ throw new RuntimeException("Could not create proxy for " +
+ clazz.getName(), e);
}
}
}