
org.apache.ibatis.javassist.convert.TransformCallToStatic Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mybatis Show documentation
Show all versions of mybatis Show documentation
The MyBatis SQL mapper framework makes it easier to use a relational database with object-oriented
applications. MyBatis couples objects with stored procedures or SQL statements using a XML descriptor or
annotations. Simplicity is the biggest advantage of the MyBatis data mapper over object relational mapping
tools.
The newest version!
package org.apache.ibatis.javassist.convert;
import org.apache.ibatis.javassist.CtMethod;
import org.apache.ibatis.javassist.bytecode.CodeIterator;
import org.apache.ibatis.javassist.bytecode.ConstPool;
import org.apache.ibatis.javassist.bytecode.Descriptor;
import org.apache.ibatis.javassist.bytecode.Opcode;
public class TransformCallToStatic extends TransformCall {
public TransformCallToStatic(Transformer next, CtMethod origMethod, CtMethod substMethod) {
super(next, origMethod, substMethod);
methodDescriptor = origMethod.getMethodInfo2().getDescriptor();
}
@Override
protected int match(int c, int pos, CodeIterator iterator, int typedesc, ConstPool cp) {
if (newIndex == 0) {
String desc = Descriptor.insertParameter(classname, methodDescriptor);
int nt = cp.addNameAndTypeInfo(newMethodname, desc);
int ci = cp.addClassInfo(newClassname);
newIndex = cp.addMethodrefInfo(ci, nt);
constPool = cp;
}
iterator.writeByte(Opcode.INVOKESTATIC, pos);
iterator.write16bit(newIndex, pos + 1);
return pos;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy