javassist.bytecode.annotation.Annotation.toAnnotationType()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(147)

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

Annotation.toAnnotationType介绍

[英]Constructs an annotation-type object representing this annotation. For example, if this annotation represents @Author, this method returns an Author object.
[中]构造表示此注释的注释类型对象。例如,如果此注释表示@Author,则此方法返回Author对象。

代码示例

代码示例来源:origin: redisson/redisson

private static Object toAnnoType(Annotation anno, ClassPool cp)
  throws ClassNotFoundException
{
  try {
    ClassLoader cl = cp.getClassLoader();
    return anno.toAnnotationType(cl, cp);
  }
  catch (ClassNotFoundException e) {
    ClassLoader cl2 = cp.getClass().getClassLoader();
    try {
      return anno.toAnnotationType(cl2, cp);
    }
    catch (ClassNotFoundException e2){
      try {
        Class clazz = cp.get(anno.getTypeName()).toClass();
        return javassist.bytecode.annotation.AnnotationImpl.make(
                    clazz.getClassLoader(),
                    clazz, cp, anno);
      }
      catch (Throwable e3) {
        throw new ClassNotFoundException(anno.getTypeName());
      }
    }
  }
}

代码示例来源:origin: org.javassist/javassist

private static Object toAnnoType(Annotation anno, ClassPool cp)
  throws ClassNotFoundException
{
  try {
    ClassLoader cl = cp.getClassLoader();
    return anno.toAnnotationType(cl, cp);
  }
  catch (ClassNotFoundException e) {
    ClassLoader cl2 = cp.getClass().getClassLoader();
    try {
      return anno.toAnnotationType(cl2, cp);
    }
    catch (ClassNotFoundException e2){
      try {
        Class<?> clazz = cp.get(anno.getTypeName()).toClass();
        return javassist.bytecode.annotation.AnnotationImpl.make(
                    clazz.getClassLoader(),
                    clazz, cp, anno);
      }
      catch (Throwable e3) {
        throw new ClassNotFoundException(anno.getTypeName());
      }
    }
  }
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

private static Object toAnnoType(Annotation anno, ClassPool cp)
  throws ClassNotFoundException
{
  try {
    ClassLoader cl = cp.getClassLoader();
    return anno.toAnnotationType(cl, cp);
  }
  catch (ClassNotFoundException e) {
    ClassLoader cl2 = cp.getClass().getClassLoader();
    return anno.toAnnotationType(cl2, cp);
  }
}

代码示例来源:origin: org.jboss.javassist/com.springsource.javassist

private static Object toAnnoType(Annotation anno, ClassPool cp)
  throws ClassNotFoundException
{
  try {
    ClassLoader cl = cp.getClassLoader();
    return anno.toAnnotationType(cl, cp);
  }
  catch (ClassNotFoundException e) {
    ClassLoader cl2 = cp.getClass().getClassLoader();
    return anno.toAnnotationType(cl2, cp);
  }
}

代码示例来源:origin: hstaudacher/osgi-jax-rs-connector

private static Object toAnnoType(Annotation anno, ClassPool cp)
  throws ClassNotFoundException
{
  try {
    ClassLoader cl = cp.getClassLoader();
    return anno.toAnnotationType(cl, cp);
  }
  catch (ClassNotFoundException e) {
    ClassLoader cl2 = cp.getClass().getClassLoader();
    return anno.toAnnotationType(cl2, cp);
  }
}

代码示例来源:origin: org.jboss/javassist

private static Object toAnnoType(Annotation anno, ClassPool cp)
  throws ClassNotFoundException
{
  try {
    ClassLoader cl = cp.getClassLoader();
    return anno.toAnnotationType(cl, cp);
  }
  catch (ClassNotFoundException e) {
    ClassLoader cl2 = cp.getClass().getClassLoader();
    return anno.toAnnotationType(cl2, cp);
  }
}

代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all

private static Object toAnnoType(Annotation anno, ClassPool cp)
  throws ClassNotFoundException
{
  try {
    ClassLoader cl = cp.getClassLoader();
    return anno.toAnnotationType(cl, cp);
  }
  catch (ClassNotFoundException e) {
    ClassLoader cl2 = cp.getClass().getClassLoader();
    return anno.toAnnotationType(cl2, cp);
  }
}

代码示例来源:origin: com.github.mkolisnyk/cucumber-runner

return (ExtendedCucumberOptions) anno.toAnnotationType(
    this.getClass().getClassLoader(), ClassPool.getDefault());

代码示例来源:origin: com.github.mkolisnyk/cucumber-runner

result[index] = (CucumberOptions) anno.toAnnotationType(
    this.getClass().getClassLoader(), ClassPool.getDefault());
index++;

相关文章