Class InvocationHandlerForUnitTestingByteWeavedClasses
java.lang.Object
org.broadleafcommerce.common.util.InvocationHandlerForUnitTestingByteWeavedClasses
- All Implemented Interfaces:
InvocationHandler
public class InvocationHandlerForUnitTestingByteWeavedClasses
extends Object
implements InvocationHandler
Invocation handler for unit testing byte-weaved classes. Use this InvocationHandler and utility method when Spring is unavailable
to complete byte-weaving.
- Author:
- Joshua Skorton (jskorton)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInvocationHandlerForUnitTestingByteWeavedClasses
(Object[] objectsForByteWeaving) -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
createProxy
(Class<T> proxyType, Class<?>[] interfaces, Object[] objectsForByteWeaving) This utility method will return a Proxy of a chosen type that response to an array of chose Interfaces and uses a InvocationHandlerForUnitTestingByteWeavedClasses that is backed by an array of chosen Objects.Object[]
Returns an array of Objects that are meant to be byte-weaved.Will invoke a chosen method against an array of Objects that are meant to be byte-weaved together.void
setObjectsForByteWeaving
(Object[] objects) Sets an array of Objects that are meant to be byte-weaved.
-
Field Details
-
objectsForByteWeaving
-
-
Constructor Details
-
InvocationHandlerForUnitTestingByteWeavedClasses
-
-
Method Details
-
createProxy
public static <T> T createProxy(Class<T> proxyType, Class<?>[] interfaces, Object[] objectsForByteWeaving) This utility method will return a Proxy of a chosen type that response to an array of chose Interfaces and uses a InvocationHandlerForUnitTestingByteWeavedClasses that is backed by an array of chosen Objects.- Parameters:
proxyType
-interfaces
-objectsForByteWeaving
-- Returns:
-
invoke
Will invoke a chosen method against an array of Objects that are meant to be byte-weaved together. Invoke will return when the first object is found that can be successfully used with the chosen method. If no objects are found to work with the chosen method, null will be returned.- Specified by:
invoke
in interfaceInvocationHandler
- Throws:
Throwable
-
getObjectsForByteWeaving
Returns an array of Objects that are meant to be byte-weaved.- Returns:
-
setObjectsForByteWeaving
Sets an array of Objects that are meant to be byte-weaved.- Parameters:
objects
-
-