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


    public static void checkEventBindings(WebBeansContext webBeansContext, Annotation... annotations)
    {
        for(Annotation ann : annotations)
        {
            //This is added, because TCK Event tests for this.
            Retention retention = ann.annotationType().getAnnotation(Retention.class);
            RetentionPolicy policy = retention.value();
            if(!policy.equals(RetentionPolicy.RUNTIME))
            {
                throw new IllegalArgumentException("Event qualifiere RetentionPolicy must be RUNTIME for qualifier : " + ann);
            }
            ///////////////////////////////////////////////////////
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

    public static void checkEventBindings(Annotation... annotations)
    {
        for(Annotation ann : annotations)
        {
            //This is added, because TCK Event tests for this.
            Retention retention = ann.annotationType().getAnnotation(Retention.class);
            RetentionPolicy policy = retention.value();
            if(!policy.equals(RetentionPolicy.RUNTIME))
            {
                throw new IllegalArgumentException("Event qualifiere RetentionPolicy must be RUNTIME for qualifier : " + ann);
            }
            ///////////////////////////////////////////////////////
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

        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

     *
     * @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

     * @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

                member.setValue(newValue);
                checkAnnotationMemberValue(newValue);
            }
            if(annType.isResolved()) {
              Class annTypeClass = annType.getTypeClass();
              Retention retAnn = (Retention) annTypeClass.getAnnotation(Retention.class);
              if (retAnn != null && retAnn.value().equals(RetentionPolicy.RUNTIME)) {
                AnnotationNode anyPrevAnnNode = tmpAnnotations.put(annTypeClass.getName(), an);
                if(anyPrevAnnNode != null) {
                  addError("Cannot specify duplicate annotation on the same member : " + annType.getName(), an);
                }
              }
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.