Package com.groiss.component
Class LoggingWrapper
java.lang.Object
com.groiss.component.LoggingWrapper
- All Implemented Interfaces:
InvocationHandler
adds logging support to arbitrary classes implementing interfaces
a dynamic-proxy is used
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <O> O
createWrappedInstance
(String clazzname) loads the class with the passed classname and returns a logging-enabled instance returned bywrap(Object)
static <O> O
unwrap
(O proxy) static <O> O
returns a java-dynamic proxy implementing all interfaces the passed object is implementing the returned object is NOT type of the handler.getClass() the wrapping can be disabled using the property ''
-
Field Details
-
logger
public static final org.slf4j.Logger logger
-
-
Method Details
-
createWrappedInstance
public static <O> O createWrappedInstance(String clazzname) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException loads the class with the passed classname and returns a logging-enabled instance returned bywrap(Object)
- Type Parameters:
O
-- Parameters:
clazzname
-- Returns:
- Throws:
InstantiationException
IllegalAccessException
ClassNotFoundException
SecurityException
NoSuchMethodException
InvocationTargetException
IllegalArgumentException
-
wrap
returns a java-dynamic proxy implementing all interfaces the passed object is implementing the returned object is NOT type of the handler.getClass() the wrapping can be disabled using the property '' -
unwrap
public static <O> O unwrap(O proxy) -
invoke
- Specified by:
invoke
in interfaceInvocationHandler
- Throws:
Throwable
-