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


Java AccessFlag.isProtected方法代码示例

本文整理汇总了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);
}
 
开发者ID:pietrobraione,项目名称:jbse,代码行数:25,代码来源:ClassFileJavassist.java

示例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...'");
    }
  }
}
 
开发者ID:emmby,项目名称:easy-a,代码行数:34,代码来源:LxgLifeCycleProcessor.java

示例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...'");
    }
  }
}
 
开发者ID:stephanenicolas,项目名称:loglifecycle,代码行数:33,代码来源:LogLifeCycleProcessor.java

示例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;
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:7,代码来源:ClassPublifier.java

示例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;
}
 
开发者ID:OpenModLoader,项目名称:Enigma,代码行数:7,代码来源:ClassPublifier.java

示例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;
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-Enigma,代码行数:7,代码来源:ClassPublifier.java

示例7: isProtected

import javassist.bytecode.AccessFlag; //导入方法依赖的package包/类
public boolean isProtected() {
    return AccessFlag.isProtected(classFile.getAccessFlags());
}
 
开发者ID:JadiraOrg,项目名称:jadira,代码行数:4,代码来源:JType.java

示例8: isProtected

import javassist.bytecode.AccessFlag; //导入方法依赖的package包/类
public boolean isProtected() {
    return AccessFlag.isProtected(getMethodInfo().getAccessFlags());
}
 
开发者ID:JadiraOrg,项目名称:jadira,代码行数:4,代码来源:JMethod.java


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