本文整理汇总了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());
}
}
示例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
}
示例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;
}
示例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());
}
示例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;
}