Package com.atlassian.crowd.common.util
Class ProxyUtil
java.lang.Object
com.atlassian.crowd.common.util.ProxyUtil
Utility class simplifying creation of proxy objects.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Tstatic <T> TnewProxy(T service, InvocationHandler handler) static <T> TrunInTransaction(T service, Function<Supplier<?>, ?> transactionalRunner) static <T> TrunWithContextClassLoader(ClassLoader classLoader, T service) Creates a proxy that will callservicewith providedclassLoader.
-
Method Details
-
runWithContextClassLoader
Creates a proxy that will callservicewith providedclassLoader. After the call original context class loader will be restored. -
runInTransaction
-
cached
-
newProxy
- Type Parameters:
T- the target interface- Parameters:
service- to be proxiedhandler- that intercepts method invocations- Returns:
- a proxy of the target interface
- Throws:
ClassCastException- if the service does not have any interfaces, or T is not an interface
-