com.sun.tools.javac.model.AnnotationProxyMaker Java Examples

The following examples show how to use com.sun.tools.javac.model.AnnotationProxyMaker. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UTemplater.java    From Refaster with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public static ImmutableClassToInstanceMap<Annotation> annotationMap(Symbol symbol) {
  ImmutableClassToInstanceMap.Builder<Annotation> builder = ImmutableClassToInstanceMap.builder();
  for (Compound compound : symbol.getAnnotationMirrors()) {
    Name qualifiedAnnotationType =
        ((TypeElement) compound.getAnnotationType().asElement()).getQualifiedName();
    try {
      Class<? extends Annotation> annotationClazz = 
          Class.forName(qualifiedAnnotationType.toString()).asSubclass(Annotation.class);
      builder.put((Class) annotationClazz,
          AnnotationProxyMaker.generateAnnotation(compound, annotationClazz));
    } catch (ClassNotFoundException e) {
      throw new IllegalArgumentException("Unrecognized annotation type", e);
    }
  }
  return builder.build();
}
 
Example #2
Source File: AnnoConstruct.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public <A extends Annotation> A getAnnotation(Class<A> annoType) {

        if (!annoType.isAnnotation())
            throw new IllegalArgumentException("Not an annotation type: " + annoType);

        Attribute.Compound c = getAttribute(annoType);
        return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
    }
 
Example #3
Source File: AnnoConstruct.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public <A extends Annotation> A getAnnotation(Class<A> annoType) {

        if (!annoType.isAnnotation())
            throw new IllegalArgumentException("Not an annotation type: " + annoType);

        Attribute.Compound c = getAttribute(annoType);
        return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
    }
 
Example #4
Source File: AnnoConstruct.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public <A extends Annotation> A getAnnotation(Class<A> annoType) {

        if (!annoType.isAnnotation())
            throw new IllegalArgumentException("Not an annotation type: " + annoType);

        Attribute.Compound c = getAttribute(annoType);
        return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
    }
 
Example #5
Source File: AnnoConstruct.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@DefinedBy(Api.LANGUAGE_MODEL)
public <A extends Annotation> A getAnnotation(Class<A> annoType) {

    if (!annoType.isAnnotation())
        throw new IllegalArgumentException("Not an annotation type: " + annoType);

    Attribute.Compound c = getAttribute(annoType);
    return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
}
 
Example #6
Source File: AnnoConstruct.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public <A extends Annotation> A getAnnotation(Class<A> annoType) {

        if (!annoType.isAnnotation())
            throw new IllegalArgumentException("Not an annotation type: " + annoType);

        Attribute.Compound c = getAttribute(annoType);
        return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
    }
 
Example #7
Source File: AnnoConstruct.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@DefinedBy(Api.LANGUAGE_MODEL)
public <A extends Annotation> A getAnnotation(Class<A> annoType) {

    if (!annoType.isAnnotation())
        throw new IllegalArgumentException("Not an annotation type: " + annoType);

    Attribute.Compound c = getAttribute(annoType);
    return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
}
 
Example #8
Source File: AnnoConstruct.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public <A extends Annotation> A getAnnotation(Class<A> annoType) {

        if (!annoType.isAnnotation())
            throw new IllegalArgumentException("Not an annotation type: " + annoType);

        Attribute.Compound c = getAttribute(annoType);
        return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
    }
 
Example #9
Source File: AnnoConstruct.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public <A extends Annotation> A getAnnotation(Class<A> annoType) {

        if (!annoType.isAnnotation())
            throw new IllegalArgumentException("Not an annotation type: " + annoType);

        Attribute.Compound c = getAttribute(annoType);
        return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
    }
 
Example #10
Source File: AnnoConstruct.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public <A extends Annotation> A getAnnotation(Class<A> annoType) {

        if (!annoType.isAnnotation())
            throw new IllegalArgumentException("Not an annotation type: " + annoType);

        Attribute.Compound c = getAttribute(annoType);
        return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
    }