public boolean areCapturedClasses( @Nonnull Class<?> mockedClass1, @Nonnull Class<?> mockedClass2) { for (CaptureTransformer<?> captureTransformer : captureTransformers) { if (captureTransformer.areCapturedClasses(mockedClass1, mockedClass2)) { return true; } } return false; }
public void removeCaptureTransformers(int previousTransformerCount) { int currentTransformerCount = captureTransformers.size(); for (int i = currentTransformerCount - 1; i >= previousTransformerCount; i--) { CaptureTransformer<?> transformer = captureTransformers.get(i); transformer.deactivate(); Startup.instrumentation().removeTransformer(transformer); captureTransformers.remove(i); } }
@Nullable public CaptureOfNewInstances findCaptureOfImplementations(@Nonnull Class<?> baseType) { for (CaptureTransformer<?> captureTransformer : captureTransformers) { CaptureOfNewInstances capture = captureTransformer.getCaptureOfImplementationsIfApplicable(baseType); if (capture != null) { return capture; } } return null; }