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


Java CodeSignature.getParameterNames方法代码示例

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


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

示例1: enterMethod

import org.aspectj.lang.reflect.CodeSignature; //导入方法依赖的package包/类
private void enterMethod(ProceedingJoinPoint joinPoint) {

        CodeSignature signature = (CodeSignature) joinPoint.getSignature();
        Class<?> clz = signature.getDeclaringType();
        String methodName = signature.getName();
        String[] paramNames = signature.getParameterNames();
        Object[] paramValues = joinPoint.getArgs();

        StringBuilder builder = new StringBuilder("\[email protected] Enter---------------------------------\n");
        if (Looper.getMainLooper() != Looper.myLooper()) {
            //非主线程,打印线程信息
            builder.append("[").append(Thread.currentThread().getName()).append("] ");
        }
        builder.append(methodName).append(":\n");
        for (int i = 0; i < paramValues.length; i++) {
            //此处可以对类型进行判断,读出更有意义的信息
            builder.append(paramNames[i])
                    .append("=")
                    .append(paramValues[i])
                    .append("\n");
        }
        builder.append("\[email protected] Enter end---------------------------------\n");
        Log.d(clz.getSimpleName(), builder.toString());
    }
 
开发者ID:jiangkang,项目名称:KTools,代码行数:25,代码来源:L.java

示例2: enter

import org.aspectj.lang.reflect.CodeSignature; //导入方法依赖的package包/类
private void enter(JoinPoint joinPoint, StringBuilder builder) {
  int line = addThread(joinPoint, builder);
  int tab = lineSet.headSet(line).size();
  for (int i = 0; i < tab; i++) {
    builder.append("\t\u21E3  ");
  }
  CodeSignature codeSignature = (CodeSignature) joinPoint.getSignature();
  Object[] parameterValues = joinPoint.getArgs();
  String[] parameterNames = codeSignature.getParameterNames();
  for (int i = 0; i < parameterValues.length; i++) {
    if (i > 0) {
      builder.append(", ");
    }
    builder.append(parameterNames[i]).append('=');
    builder.append(Strings.toString(parameterValues[i]));
  }
}
 
开发者ID:pt2121,项目名称:MarbledCat,代码行数:18,代码来源:MarbledCat.java

示例3: getJoinPointContextMap

import org.aspectj.lang.reflect.CodeSignature; //导入方法依赖的package包/类
public static Map<String, Object> getJoinPointContextMap(JoinPoint jp) {
	Map<String, Object> context = new HashMap<String, Object>();
	context.put("_jp", jp);
	// convenience binding
	context.put("_this", jp.getThis());
	context.put("_target", jp.getTarget());
	context.put("_args", jp.getArgs());
	Signature sig = jp.getSignature();
	if (sig instanceof CodeSignature) {
		CodeSignature codeSig = (CodeSignature) sig;
		String[] paramNames = codeSig.getParameterNames();
		Object[] args = jp.getArgs();
		for (int i = 0; i < paramNames.length; i++) {
			context.put(paramNames[i], args[i]);
		}
	}
	return context;
}
 
开发者ID:sobkowiak,项目名称:aspectj-in-action-code,代码行数:19,代码来源:JoinPointContextUtil.java

示例4: enterMethod

import org.aspectj.lang.reflect.CodeSignature; //导入方法依赖的package包/类
private static void enterMethod(JoinPoint joinPoint) {
  if (!enabled) return;

  CodeSignature codeSignature = (CodeSignature) joinPoint.getSignature();

  Class<?> cls = codeSignature.getDeclaringType();
  String methodName = codeSignature.getName();
  String[] parameterNames = codeSignature.getParameterNames();
  Object[] parameterValues = joinPoint.getArgs();

  StringBuilder builder = new StringBuilder("\u21E2 ");
  builder.append(methodName).append('(');
  for (int i = 0; i < parameterValues.length; i++) {
    if (i > 0) {
      builder.append(", ");
    }
    builder.append(parameterNames[i]).append('=');
    builder.append(Strings.toString(parameterValues[i]));
  }
  builder.append(')');

  /*// Log when current thread is not the main thread
  if (Looper.myLooper() != Looper.getMainLooper()) {
    builder.append(" [Thread:\"").append(Thread.currentThread().getName()).append("\"]");
  }*/

  // TODO : use a real Logger
  System.out.println(asTag(cls) + " : " + builder.toString());
  
}
 
开发者ID:fpoyer,项目名称:Hugo-Spring,代码行数:31,代码来源:Hugo.java

示例5: logMethodParams

import org.aspectj.lang.reflect.CodeSignature; //导入方法依赖的package包/类
private void logMethodParams(ProceedingJoinPoint joinPoint, CodeSignature signature) {
    String[] parameterNames = signature.getParameterNames();
    Object[] args = joinPoint.getArgs();
    try {
        for (int i = 0; i < parameterNames.length; i++) {
            LogSession.log("request-param-" + parameterNames[i], args[i] != null ? args[i].toString() : "null");
        }
    } catch (Exception ex) {
        LogSession.log("request-param-log-error", "true");
    }
}
 
开发者ID:HelfenKannJeder,项目名称:come2help,代码行数:12,代码来源:RequestLogger.java

示例6: enterMethod

import org.aspectj.lang.reflect.CodeSignature; //导入方法依赖的package包/类
private static void enterMethod(JoinPoint joinPoint) {
  if (!enabled) return;

  CodeSignature codeSignature = (CodeSignature) joinPoint.getSignature();

  Class<?> cls = codeSignature.getDeclaringType();
  String methodName = codeSignature.getName();
  String[] parameterNames = codeSignature.getParameterNames();
  Object[] parameterValues = joinPoint.getArgs();

  StringBuilder builder = new StringBuilder("\u21E2 ");
  builder.append(methodName).append('(');
  for (int i = 0; i < parameterValues.length; i++) {
    if (i > 0) {
      builder.append(", ");
    }
    builder.append(parameterNames[i]).append('=');
    builder.append(Strings.toString(parameterValues[i]));
  }
  builder.append(')');

  if (Looper.myLooper() != Looper.getMainLooper()) {
    builder.append(" [Thread:\"").append(Thread.currentThread().getName()).append("\"]");
  }

  Log.v(asTag(cls), builder.toString());

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
    final String section = builder.toString().substring(2);
    Trace.beginSection(section);
  }
}
 
开发者ID:JakeWharton,项目名称:hugo,代码行数:33,代码来源:Hugo.java


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