Package java.lang.annotation

Examples of java.lang.annotation.Retention


     *
     * @param markerClass the marker annotation class
     */
    public static void validateMarkerAnnotation(Class markerClass)
    {
        Retention policy = (Retention) markerClass.getAnnotation(Retention.class);

        if (policy != null && policy.value() == RetentionPolicy.RUNTIME)
            return;

        throw new IllegalArgumentException(UtilMessages.badMarkerAnnotation(markerClass));
    }
View Full Code Here


            for (Annotation annotation : constructor.getDeclaredAnnotations()) {
                if (annotation.annotationType().getAnnotation(Inherited.class) != null) {
                    continue;
                }
                Retention retention = annotation.annotationType().getAnnotation(Retention.class);
                AnnotationVisitor annotationVisitor = methodVisitor.visitAnnotation(Type.getType(annotation.annotationType()).getDescriptor(), retention != null && retention.value() == RetentionPolicy.RUNTIME);
                annotationVisitor.visitEnd();
            }

            methodVisitor.visitCode();
View Full Code Here

    return paramClass.getDeclaredMethods().length == 0;
  }

  public static boolean isRetainedAtRuntime(Class paramClass)
  {
    Retention localRetention = (Retention)paramClass.getAnnotation(Retention.class);
    return (localRetention != null) && (localRetention.value() == RetentionPolicy.RUNTIME);
  }
View Full Code Here

    return paramClass.getDeclaredMethods().length == 0;
  }

  public static boolean isRetainedAtRuntime(Class paramClass)
  {
    Retention localRetention = (Retention)paramClass.getAnnotation(Retention.class);
    return (localRetention != null) && (localRetention.value() == RetentionPolicy.RUNTIME);
  }
View Full Code Here

    return new Not(paramMatcher, null);
  }

  private static void checkForRuntimeRetention(Class paramClass)
  {
    Retention localRetention = (Retention)paramClass.getAnnotation(Retention.class);
    $Preconditions.checkArgument((localRetention != null) && (localRetention.value() == RetentionPolicy.RUNTIME), "Annotation " + paramClass.getSimpleName() + " is missing RUNTIME retention");
  }
View Full Code Here

        private static final long serialVersionUID = 0;
    }

    private static void checkForRuntimeRetention(
            Class<? extends Annotation> annotationType) {
        Retention retention = annotationType.getAnnotation(Retention.class);
        checkArgument(retention != null && retention.value() == RetentionPolicy.RUNTIME,
                "Annotation " + annotationType.getSimpleName() + " is missing RUNTIME retention");
    }
View Full Code Here

    /**
     * Returns true if the given annotation is retained at runtime.
     */
    public static boolean isRetainedAtRuntime(Class<? extends Annotation> annotationType) {
        Retention retention = annotationType.getAnnotation(Retention.class);
        return retention != null && retention.value() == RetentionPolicy.RUNTIME;
    }
View Full Code Here

   
      if (! _cdiManager.isQualifier(annType))
        throw new IllegalArgumentException(L.l("'{0}' is an invalid event annotation because it's not a @Qualifier.",
                                               qualifierA));
   
      Retention retention = annType.getAnnotation(Retention.class);
   
      if (retention == null || retention.value() != RetentionPolicy.RUNTIME) {
        throw new IllegalArgumentException(L.l("'{0}' is an invalid event qualifier because it doesn't have RUNTIME retention.",
                                               qualifierA));       
      }
   
      for (int j = i + 1; j < length; j++) {
View Full Code Here

   {
      try
      {
         Class ann = classloader.loadClass(annotation);
         if (!ann.isAnnotation()) return null;
         Retention retention = (Retention) ann.getAnnotation(Retention.class);
         if (retention != null && retention.value() == RetentionPolicy.RUNTIME) return ann;

      }
      catch (ClassNotFoundException ignored)
      {
      }
View Full Code Here

  private static RetentionPolicy getRetentionPolicy(
      Class<? extends java.lang.annotation.Annotation> clazz) {
    // Default retention policy is CLASS, see @Retention.
    RetentionPolicy retentionPolicy = RetentionPolicy.CLASS;
    Retention retentionAnnotation = clazz.getAnnotation(Retention.class);
    if (retentionAnnotation != null) {
      retentionPolicy = retentionAnnotation.value();
    }
    return retentionPolicy;
  }
View Full Code Here

TOP

Related Classes of java.lang.annotation.Retention

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.