javassist.bytecode.Bytecode.addGetfield()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中javassist.bytecode.Bytecode.addGetfield()方法的一些代码示例,展示了Bytecode.addGetfield()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bytecode.addGetfield()方法的具体详情如下:
包路径:javassist.bytecode.Bytecode
类名称:Bytecode
方法名:addGetfield

Bytecode.addGetfield介绍

[英]Appends GETFIELD.
[中]附加GETFIELD。

代码示例

代码示例来源:origin: redisson/redisson

private static void addGetter(String classname, ClassFile cf, ConstPool cp)
  throws CannotCompileException
{
  MethodInfo minfo = new MethodInfo(cp, HANDLER_GETTER,
                   HANDLER_GETTER_TYPE);
  minfo.setAccessFlags(AccessFlag.PUBLIC);
  Bytecode code = new Bytecode(cp, 1, 1);
  code.addAload(0);
  code.addGetfield(classname, HANDLER, HANDLER_TYPE);
  code.addOpcode(Bytecode.ARETURN);
  minfo.setCodeAttribute(code.toCodeAttribute());
  cf.addMethod(minfo);
}

代码示例来源:origin: redisson/redisson

code.addGetfield(thisClassName, HANDLER, HANDLER_TYPE);
code.addAload(0);

代码示例来源:origin: org.javassist/javassist

private static void addGetter(String classname, ClassFile cf, ConstPool cp)
  throws CannotCompileException
{
  MethodInfo minfo = new MethodInfo(cp, HANDLER_GETTER,
                   HANDLER_GETTER_TYPE);
  minfo.setAccessFlags(AccessFlag.PUBLIC);
  Bytecode code = new Bytecode(cp, 1, 1);
  code.addAload(0);
  code.addGetfield(classname, HANDLER, HANDLER_TYPE);
  code.addOpcode(Bytecode.ARETURN);
  minfo.setCodeAttribute(code.toCodeAttribute());
  cf.addMethod(minfo);
}

代码示例来源:origin: org.javassist/javassist

code.addGetfield(thisClassName, HANDLER, HANDLER_TYPE);
code.addAload(0);

代码示例来源:origin: opentripplanner/OpenTripPlanner

/**
 * Add a simple getter with signature "double getFoo()" to the class, which simply returns the value of the 
 * field fieldName 
 * @param ctClass
 * @param classFile
 * @param fieldName
 * @throws DuplicateMemberException
 */
private void addDoubleGetter(ClassFile classFile, String fieldName)
    throws DuplicateMemberException {
  ConstPool constPool = classFile.getConstPool();
  // double getFoo()
  MethodInfo getter = new MethodInfo(constPool, "get" + ucfirst(fieldName), "()D");
  Bytecode code = new Bytecode(constPool, 2, 1);
  // load this
  code.addAload(0);
  code.addGetfield(ctClass, fieldName, "D");
  // return with value
  code.addOpcode(Opcode.DRETURN);
  getter.setCodeAttribute(code.toCodeAttribute());
  getter.setAccessFlags(AccessFlag.PUBLIC);
  classFile.addMethod(getter);
}

代码示例来源:origin: redisson/redisson

code.addGetfield(Bytecode.THIS, fieldName, fieldType);
code.setMaxLocals(1);

代码示例来源:origin: org.javassist/javassist

code.addGetfield(Bytecode.THIS, fieldName, fieldType);
code.setMaxLocals(1);

代码示例来源:origin: redisson/redisson

if ((finfo.getAccessFlags() & AccessFlag.STATIC) == 0) {
  code.addAload(0);
  code.addGetfield(Bytecode.THIS, fieldName, fieldType);

代码示例来源:origin: org.javassist/javassist

if ((finfo.getAccessFlags() & AccessFlag.STATIC) == 0) {
  code.addAload(0);
  code.addGetfield(Bytecode.THIS, fieldName, fieldType);

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

private static void addGetter(String classname, ClassFile cf, ConstPool cp)
  throws CannotCompileException
{
  MethodInfo minfo = new MethodInfo(cp, HANDLER_GETTER,
                   HANDLER_GETTER_TYPE);
  minfo.setAccessFlags(AccessFlag.PUBLIC);
  Bytecode code = new Bytecode(cp, 1, 1);
  code.addAload(0);
  code.addGetfield(classname, HANDLER, HANDLER_TYPE);
  code.addOpcode(Bytecode.ARETURN);
  minfo.setCodeAttribute(code.toCodeAttribute());
  cf.addMethod(minfo);
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

private static void addGetter(String classname, ClassFile cf, ConstPool cp)
  throws CannotCompileException
{
  MethodInfo minfo = new MethodInfo(cp, HANDLER_GETTER,
                   HANDLER_GETTER_TYPE);
  minfo.setAccessFlags(AccessFlag.PUBLIC);
  Bytecode code = new Bytecode(cp, 1, 1);
  code.addAload(0);
  code.addGetfield(classname, HANDLER, HANDLER_TYPE);
  code.addOpcode(Bytecode.ARETURN);
  minfo.setCodeAttribute(code.toCodeAttribute());
  cf.addMethod(minfo);
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

private static void addGetter(String classname, ClassFile cf, ConstPool cp)
  throws CannotCompileException
{
  MethodInfo minfo = new MethodInfo(cp, HANDLER_GETTER,
                   HANDLER_GETTER_TYPE);
  minfo.setAccessFlags(AccessFlag.PUBLIC);
  Bytecode code = new Bytecode(cp, 1, 1);
  code.addAload(0);
  code.addGetfield(classname, HANDLER, HANDLER_TYPE);
  code.addOpcode(Bytecode.ARETURN);
  minfo.setCodeAttribute(code.toCodeAttribute());
  cf.addMethod(minfo);
}

代码示例来源:origin: org.jboss.javassist/com.springsource.javassist

private static void addGetter(String classname, ClassFile cf, ConstPool cp)
  throws CannotCompileException
{
  MethodInfo minfo = new MethodInfo(cp, HANDLER_GETTER,
                   HANDLER_GETTER_TYPE);
  minfo.setAccessFlags(AccessFlag.PUBLIC);
  Bytecode code = new Bytecode(cp, 1, 1);
  code.addAload(0);
  code.addGetfield(classname, HANDLER, HANDLER_TYPE);
  code.addOpcode(Bytecode.ARETURN);
  minfo.setCodeAttribute(code.toCodeAttribute());
  cf.addMethod(minfo);
}

代码示例来源:origin: fakereplace/fakereplace

Bytecode bc = new Bytecode(file.getConstPool(), 1, 1);
bc.addAload(0);
bc.addGetfield("org.jboss.as.jpa.service.PersistenceUnitServiceImpl", "entityManagerFactory", "Ljavax/persistence/EntityManagerFactory;");
bc.addOpcode(Bytecode.ARETURN);
MethodInfo methodInfo = new MethodInfo(file.getConstPool(), "emf", "()Ljavax/persistence/EntityManagerFactory;");

代码示例来源:origin: Blazebit/blaze-persistence

code.addGetfield(cc, field.getName(), field.getFieldInfo().getDescriptor());

代码示例来源:origin: org.jboss.javassist/com.springsource.javassist

if ((finfo.getAccessFlags() & AccessFlag.STATIC) == 0) {
  code.addAload(0);
  code.addGetfield(Bytecode.THIS, fieldName, fieldType);

代码示例来源:origin: org.jboss/javassist

if ((finfo.getAccessFlags() & AccessFlag.STATIC) == 0) {
  code.addAload(0);
  code.addGetfield(Bytecode.THIS, fieldName, fieldType);

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

if ((finfo.getAccessFlags() & AccessFlag.STATIC) == 0) {
  code.addAload(0);
  code.addGetfield(Bytecode.THIS, fieldName, fieldType);

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

if ((finfo.getAccessFlags() & AccessFlag.STATIC) == 0) {
  code.addAload(0);
  code.addGetfield(Bytecode.THIS, fieldName, fieldType);

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

if ((finfo.getAccessFlags() & AccessFlag.STATIC) == 0) {
  code.addAload(0);
  code.addGetfield(Bytecode.THIS, fieldName, fieldType);

相关文章