package org.stagemonitor.core.instrument;

import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.description.method.MethodDescription;
import net.bytebuddy.description.type.TypeDescription;

/**
 * This transformer does not modify classes but only searches for matching {@link TypeDescription} and {@link MethodDescription}s
 */
public abstract class AbstractClassPathScanner extends StagemonitorByteBuddyTransformer {

	@Override
	public AgentBuilder.Transformer getTransformer() {
		return AgentBuilder.Transformer.NoOp.INSTANCE;
	}

	@Override
	public void beforeTransformation(TypeDescription typeDescription, ClassLoader classLoader) {
		onTypeMatch(typeDescription);
	}

	protected void onTypeMatch(TypeDescription typeDescription) {
		for (MethodDescription.InDefinedShape methodDescription : typeDescription.getDeclaredMethods()
				.filter(getMethodElementMatcher())) {
			onMethodMatch(methodDescription);
		}
	}

	protected abstract void onMethodMatch(MethodDescription.InDefinedShape methodDescription);

}

@@ -198,16 +198,58 @@
 ription;
+%0Aimport net.bytebuddy.dynamic.DynamicType;
 %0A%0A/**%0A *
@@ -543,16 +543,20 @@
 %09return 
+new 
 AgentBui
@@ -575,28 +575,15 @@
 rmer
-.NoOp.INSTANCE;%0A%09%7D%0A%0A
+() %7B%0A%09%09
 %09@Ov
@@ -589,24 +589,26 @@
 verride%0A
+%09%09
 %09public 
 void bef
@@ -603,34 +603,73 @@
 lic 
-void beforeTransformation(
+DynamicType.Builder%3C?%3E transform(DynamicType.Builder%3C?%3E builder, 
 Type
@@ -726,16 +726,18 @@
 er) %7B%0A%09%09
+%09
+%09
 onTypeMa
@@ -758,16 +758,46 @@
 ption);%0A
+%09%09%09%09return builder;%0A%09%09%09%7D%0A%09%09%7D;%0A
 %09%7D%0A%0A%09pro

Fix Sla class path scanner