本文整理汇总了Java中javassist.bytecode.FieldInfo.setAccessFlags方法的典型用法代码示例。如果您正苦于以下问题:Java FieldInfo.setAccessFlags方法的具体用法?Java FieldInfo.setAccessFlags怎么用?Java FieldInfo.setAccessFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javassist.bytecode.FieldInfo
的用法示例。
在下文中一共展示了FieldInfo.setAccessFlags方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getClassFields
import javassist.bytecode.FieldInfo; //导入方法依赖的package包/类
@Override
public List<FieldInfo> getClassFields(String classname, ConstPool cp) {
final Field[] fields = clazz.getDeclaredFields();
if (null == fields || 0 == fields.length) {
return null;
}
final ArrayList<FieldInfo> ret = new ArrayList<FieldInfo>();
for (Field f : fields) {
final FieldInfo fi = new FieldInfo(cp, f.getName(), Descriptor.of(f.getClass()));
ret.add(fi);
fi.setAccessFlags(f.getModifiers());
}
return ret;
}
示例2: addFields
import javassist.bytecode.FieldInfo; //导入方法依赖的package包/类
private void addFields(ClassFile cfile, Class<?> clazz) {
final Field[] fields = clazz.getDeclaredFields();
if (null != fields && 0 < fields.length) {
for (Field f : fields) {
try {
final FieldInfo fi = new FieldInfo(cfile.getConstPool(), f.getName(), Descriptor.of(f.getType()));
fi.setAccessFlags(f.getModifiers());
cfile.addField(fi);
} catch (DuplicateMemberException e) {
e.printStackTrace();
}
}
}
}
示例3: addFieldHandlerField
import javassist.bytecode.FieldInfo; //导入方法依赖的package包/类
private void addFieldHandlerField(ClassFile classfile)
throws CannotCompileException {
ConstPool cp = classfile.getConstPool();
FieldInfo finfo = new FieldInfo(cp, HANDLER_FIELD_NAME,
HANDLER_FIELD_DESCRIPTOR);
finfo.setAccessFlags(AccessFlag.PRIVATE | AccessFlag.TRANSIENT);
classfile.addField(finfo);
}
示例4: addFieldHandlerField
import javassist.bytecode.FieldInfo; //导入方法依赖的package包/类
private void addFieldHandlerField(ClassFile classfile) throws CannotCompileException {
final ConstPool constPool = classfile.getConstPool();
final FieldInfo fieldInfo = new FieldInfo( constPool, HANDLER_FIELD_NAME, HANDLER_FIELD_DESCRIPTOR );
fieldInfo.setAccessFlags( AccessFlag.PRIVATE | AccessFlag.TRANSIENT );
classfile.addField( fieldInfo );
}