org.aspectj.lang.Aspects.getSingletonOrThreadAspectOf()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中org.aspectj.lang.Aspects.getSingletonOrThreadAspectOf()方法的一些代码示例,展示了Aspects.getSingletonOrThreadAspectOf()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Aspects.getSingletonOrThreadAspectOf()方法的具体详情如下:
包路径:org.aspectj.lang.Aspects
类名称:Aspects
方法名:getSingletonOrThreadAspectOf

Aspects.getSingletonOrThreadAspectOf介绍

暂无

代码示例

代码示例来源:origin: astefanutti/metrics-aspectj

/**
 * Returns the singleton aspect or the percflow / percflowbelow associated with the current thread
 *
 * @param aspectClass
 * @return
 * @throws NoAspectBoundException if no such aspect
 */
public static <T> T aspectOf(Class<T> aspectClass) throws NoAspectBoundException {
  try {
    return (T) getSingletonOrThreadAspectOf(aspectClass).invoke(null, EMPTY_OBJECT_ARRAY);
  } catch (InvocationTargetException e) {
    //FIXME asc Highly temporary change to see what the build makes of it - dont use 1.4 APIs
    throw new NoAspectBoundException(aspectClass.getName(), e);//e.getCause());
  } catch (Exception e) {
    throw new NoAspectBoundException(aspectClass.getName(), e);
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.aspectj

/**
 * Returns the singleton aspect or the percflow / percflowbelow associated with the current thread
 *
 * @param aspectClass
 * @return
 * @throws NoAspectBoundException if no such aspect
 */
public static <T> T aspectOf(Class<T> aspectClass) throws NoAspectBoundException {
  try {
    return (T) getSingletonOrThreadAspectOf(aspectClass).invoke(null, EMPTY_OBJECT_ARRAY);
  } catch (InvocationTargetException e) {
    //FIXME asc Highly temporary change to see what the build makes of it - dont use 1.4 APIs
    throw new NoAspectBoundException(aspectClass.getName(), e);//e.getCause());
  } catch (Exception e) {
    throw new NoAspectBoundException(aspectClass.getName(), e);
  }
}

相关文章