package ch.usi.inf.ajp22.agent;


import java.lang.instrument.ClassFileTransformer;
import java.security.ProtectionDomain;
import java.util.Arrays;

public class Modifier implements ClassFileTransformer {
    public byte[] transform(final ClassLoader loader,
                            final String className,
                            final Class<?> classBeingRedefined,
                            final ProtectionDomain protectionDomain,
                            byte[] classfileBuffer) {
        final byte[] newBuffer = Arrays.copyOf(classfileBuffer, classfileBuffer.length);

        if ("ch/usi/inf/ajp22/Point".equals(className)) {
            newBuffer[7] = 61;
        }

        return newBuffer;
    }
}
