本文整理汇总了Java中javassist.bytecode.AccessFlag.isProtected方法的典型用法代码示例。如果您正苦于以下问题:Java AccessFlag.isProtected方法的具体用法?Java AccessFlag.isProtected怎么用?Java AccessFlag.isProtected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javassist.bytecode.AccessFlag
的用法示例。
在下文中一共展示了AccessFlag.isProtected方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getModifiers
import javassist.bytecode.AccessFlag; //导入方法依赖的package包/类
@Override
public int getModifiers() {
//this code reimplements CtClassType.getModifiers() to circumvent a bug
int acc = this.cf.getAccessFlags();
acc = clear(acc, SUPER);
int inner = this.cf.getInnerAccessFlags();
if (inner != -1) {
if ((inner & STATIC) != 0) {
acc |= STATIC;
}
if (AccessFlag.isPublic(inner)) {
//seems that public nested classes already have the PUBLIC modifier set
//but we are paranoid and we set it again
acc = setPublic(acc);
} else if (AccessFlag.isProtected(inner)) {
acc = setProtected(acc);
} else if (AccessFlag.isPrivate(inner)) {
acc = setPrivate(acc);
} else { //package visibility
acc = setPackage(acc); //clear the PUBLIC modifier in case it is set
}
}
return AccessFlag.toModifier(acc);
}
示例2: debugLifeCycleMethods
import javassist.bytecode.AccessFlag; //导入方法依赖的package包/类
private void debugLifeCycleMethods(CtClass classToTransform, CtMethod[] methods)
throws CannotCompileException, AfterBurnerImpossibleException, NotFoundException {
for (CtMethod lifeCycleHook : methods) {
String methodName = lifeCycleHook.getName();
int accessFlags = lifeCycleHook.getMethodInfo().getAccessFlags();
boolean isFinal = (accessFlags & AccessFlag.FINAL) == AccessFlag.FINAL;
boolean canOverride = !isFinal && (AccessFlag.isPublic(accessFlags)
|| AccessFlag.isProtected(accessFlags)
|| AccessFlag.isPackage(accessFlags));
log.info("Method name: " + methodName);
if(!supportedMethods.contains(methodName))
continue;
if (canOverride && methodName.startsWith("on")) {
log.info("Overriding " + methodName);
try {
String body = "com.github.stephanenicolas.lxglifecycle.ActivityListenerUtil.internal._" + methodName + "(this);";
afterBurner.afterOverrideMethod(classToTransform, methodName, body);
log.info("Override successful " + methodName);
} catch (Exception e) {
logMoreIfDebug("Override didn't work ", e);
}
} else {
log.info(
"Skipping " + methodName + ". Either it is final, private or doesn't start by 'on...'");
}
}
}
示例3: debugLifeCycleMethods
import javassist.bytecode.AccessFlag; //导入方法依赖的package包/类
private void debugLifeCycleMethods(CtClass classToTransform, CtMethod[] methods)
throws CannotCompileException, AfterBurnerImpossibleException, NotFoundException {
for (CtMethod lifeCycleHook : methods) {
String methodName = lifeCycleHook.getName();
String className = classToTransform.getName();
int accessFlags = lifeCycleHook.getMethodInfo().getAccessFlags();
boolean isFinal = (accessFlags & AccessFlag.FINAL) == AccessFlag.FINAL;
boolean canOverride = !isFinal && (AccessFlag.isPublic(accessFlags)
|| AccessFlag.isProtected(accessFlags)
|| AccessFlag.isPackage(accessFlags));
if (canOverride && methodName.startsWith("on")) {
log.info("Overriding " + methodName);
try {
String body = "android.util.Log.d(\"LogLifeCycle\", \""
+ className
+ " [\" + System.identityHashCode(this) + \"] \u27F3 "
+ methodName
+ "\");";
afterBurner.afterOverrideMethod(classToTransform, methodName, body);
log.info("Override successful " + methodName);
} catch (Exception e) {
logMoreIfDebug("Override didn't work ", e);
}
} else {
log.info(
"Skipping " + methodName + ". Either it is final, private or doesn't start by 'on...'");
}
}
}
示例4: publify
import javassist.bytecode.AccessFlag; //导入方法依赖的package包/类
private static int publify(int flags) {
if (AccessFlag.isPrivate(flags) || AccessFlag.isProtected(flags)) {
flags = AccessFlag.setPublic(flags);
}
return flags;
}
示例5: publify
import javassist.bytecode.AccessFlag; //导入方法依赖的package包/类
private static int publify(int flags) {
if (AccessFlag.isPrivate(flags) || AccessFlag.isProtected(flags)) {
flags = AccessFlag.setPublic(flags);
}
return flags;
}
示例6: publify
import javassist.bytecode.AccessFlag; //导入方法依赖的package包/类
private static int publify(int flags)
{
if(AccessFlag.isPrivate(flags) || AccessFlag.isProtected(flags))
flags = AccessFlag.setPublic(flags);
return flags;
}
示例7: isProtected
import javassist.bytecode.AccessFlag; //导入方法依赖的package包/类
public boolean isProtected() {
return AccessFlag.isProtected(classFile.getAccessFlags());
}
示例8: isProtected
import javassist.bytecode.AccessFlag; //导入方法依赖的package包/类
public boolean isProtected() {
return AccessFlag.isProtected(getMethodInfo().getAccessFlags());
}