当前位置: 首页>>代码示例>>Java>>正文


Java CtField.getDeclaringClass方法代码示例

本文整理汇总了Java中scouter.javassist.CtField.getDeclaringClass方法的典型用法代码示例。如果您正苦于以下问题:Java CtField.getDeclaringClass方法的具体用法?Java CtField.getDeclaringClass怎么用?Java CtField.getDeclaringClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scouter.javassist.CtField的用法示例。


在下文中一共展示了CtField.getDeclaringClass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: atFieldAssignCore

import scouter.javassist.CtField; //导入方法依赖的package包/类
private void atFieldAssignCore(CtField f, boolean is_static, int fi,
                               boolean is2byte) throws CompileError {
    if (fi != 0) {
        if (is_static) {
           bytecode.add(PUTSTATIC);
           bytecode.growStack(is2byte ? -2 : -1);
        }
        else {
            bytecode.add(PUTFIELD);
            bytecode.growStack(is2byte ? -3 : -2);
        }
    
        bytecode.addIndex(fi);
    }
    else {
        CtClass declClass = f.getDeclaringClass();
        AccessorMaker maker = declClass.getAccessorMaker();
        // make should be non null.
        FieldInfo finfo = f.getFieldInfo2();
        MethodInfo minfo = maker.getFieldSetter(finfo, is_static);
        bytecode.addInvokestatic(declClass, minfo.getName(),
                                 minfo.getDescriptor());
    }
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:25,代码来源:MemberCodeGen.java

示例2: isAccessibleField

import scouter.javassist.CtField; //导入方法依赖的package包/类
/**
 * Returns null if the field is accessible.  Otherwise, it throws
 * an exception or it returns AccessorMaker if the field is a private
 * one declared in an enclosing class.
 */
private AccessorMaker isAccessibleField(CtField f, FieldInfo finfo)
    throws CompileError
{
    if (AccessFlag.isPrivate(finfo.getAccessFlags())
        && f.getDeclaringClass() != thisClass) {
        CtClass declClass = f.getDeclaringClass(); 
        if (isEnclosing(declClass, thisClass)) {
            AccessorMaker maker = declClass.getAccessorMaker();
            if (maker != null)
                return maker;
            else
                throw new CompileError("fatal error.  bug?");
        }
        else
            throw new CompileError("Field " + f.getName() + " in "
                                   + declClass.getName() + " is private.");
    }

    return null;    // accessible field
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:26,代码来源:MemberCodeGen.java

示例3: TransformFieldAccess

import scouter.javassist.CtField; //导入方法依赖的package包/类
public TransformFieldAccess(Transformer next, CtField field,
                            String newClassname, String newFieldname)
{
    super(next);
    this.fieldClass = field.getDeclaringClass();
    this.fieldname = field.getName();
    this.isPrivate = Modifier.isPrivate(field.getModifiers());
    this.newClassname = newClassname;
    this.newFieldname = newFieldname;
    this.constPool = null;
}
 
开发者ID:scouter-project,项目名称:bytescope,代码行数:12,代码来源:TransformFieldAccess.java

示例4: TransformReadField

import scouter.javassist.CtField; //导入方法依赖的package包/类
public TransformReadField(Transformer next, CtField field,
                          String methodClassname, String methodName)
{
    super(next);
    this.fieldClass = field.getDeclaringClass();
    this.fieldname = field.getName();
    this.methodClassname = methodClassname;
    this.methodName = methodName;
    this.isPrivate = Modifier.isPrivate(field.getModifiers());
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:11,代码来源:TransformReadField.java

示例5: isFieldInSuper

import scouter.javassist.CtField; //导入方法依赖的package包/类
static boolean isFieldInSuper(CtClass clazz, CtClass fclass, String fname) {
    if (!clazz.subclassOf(fclass))
        return false;

    try {
        CtField f = clazz.getField(fname);
        return f.getDeclaringClass() == fclass;
    }
    catch (NotFoundException e) {}
    return false;
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:12,代码来源:TransformReadField.java


注:本文中的scouter.javassist.CtField.getDeclaringClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。