Package java.lang.annotation

Examples of java.lang.annotation.RetentionPolicy


        if (clazz == Retention.class) {
            Expression exp = definition.getMember("value");
            if (!(exp instanceof PropertyExpression)) return;
            PropertyExpression pe = (PropertyExpression) exp;
            String name = pe.getPropertyAsString();
            RetentionPolicy policy = RetentionPolicy.valueOf(name);
            setRetentionPolicy(policy, root);
        } else if (clazz == Target.class) {
            Expression exp = definition.getMember("value");
            if (!(exp instanceof ListExpression)) return;
            ListExpression le = (ListExpression) exp;
View Full Code Here


    private void configureAnnotation(AnnotationNode node, Annotation annotation) {
        Class type = annotation.annotationType();
        if (type == Retention.class) {
            Retention r = (Retention) annotation;
            RetentionPolicy value = r.value();
            setRetentionPolicy(value, node);
            node.setMember("value", new PropertyExpression(
                    new ClassExpression(ClassHelper.makeWithoutCaching(RetentionPolicy.class, false)),
                    value.toString()));
        } else if (type == Target.class) {
            Target t = (Target) annotation;
            ElementType[] elements = t.value();
            ListExpression elementExprs = new ListExpression();
            for (ElementType element : elements) {
View Full Code Here

    {
        for (Annotation qualifier : qualifiers)
        {
            //This is added, because TCK Event tests for this.
            Retention retention = qualifier.annotationType().getAnnotation(Retention.class);
            RetentionPolicy policy = retention.value();
            if(!policy.equals(RetentionPolicy.RUNTIME))
            {
                throw new IllegalArgumentException("Event qualifier RetentionPolicy must be RUNTIME for qualifier : " + qualifier.annotationType().getName());
            }
        }
    }
View Full Code Here

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

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.