Package java.lang.annotation

Examples of java.lang.annotation.Target


        Interceptor<?> interceptorBean = interceptors.iterator().next();
        assertEquals(interceptorBean.getInterceptorBindings().size(), 1);
        assertTrue(interceptorBean.getInterceptorBindings().contains(LOGGED_LITERAL));

        Target target = (interceptorBean.getInterceptorBindings().iterator().next()).annotationType().getAnnotation(
                Target.class);
        List<ElementType> elements = Arrays.asList(target.value());
        assertTrue(elements.contains(ElementType.TYPE));
        assertTrue(elements.contains(ElementType.METHOD));
    }
View Full Code Here


    @Test(groups = { ANNOTATION_DEFINITION })
    @SpecAssertion(section = "2.4.2", id = "aa")
    public void testScopeTypeHasCorrectTarget() {
        assert getBeans(Mullet.class).size() == 1;
        Bean<Mullet> bean = getBeans(Mullet.class).iterator().next();
        Target target = bean.getScope().getAnnotation(Target.class);
        List<ElementType> elements = Arrays.asList(target.value());
        assert elements.contains(ElementType.TYPE);
        assert elements.contains(ElementType.METHOD);
        assert elements.contains(ElementType.FIELD);
    }
View Full Code Here

        Interceptor<?> interceptorBean = interceptors.iterator().next();
        assert interceptorBean.getInterceptorBindings().size() == 1;
        assert interceptorBean.getInterceptorBindings().contains(new AnnotationLiteral<Logged>() {
        });

        Target target = (interceptorBean.getInterceptorBindings().iterator().next()).annotationType().getAnnotation(
                Target.class);
        List<ElementType> elements = Arrays.asList(target.value());
        assert elements.contains(ElementType.TYPE);
        assert elements.contains(ElementType.METHOD);
    }
View Full Code Here

      if (annotation == null)
         throw new IllegalArgumentException("Null annotation!");
      this.annotation = annotation;

      this.types = new HashSet<ElementType>();
      Target target = annotation.getAnnotation(Target.class);
      if (target != null)
      {
         List<ElementType> list = Arrays.asList(target.value());
         for(ElementType type : list)
         {
            if (isElementTypeSupported(type))
            {
               types.add(type);
View Full Code Here

        String fullName();
    }
    public static boolean isJAXB22() {
        Target t = XmlElement.class.getAnnotation(Target.class);
        //JAXB 2.2 allows XmlElement on params.
        for (ElementType et : t.value()) {
            if (et == ElementType.PARAMETER) {
                return true;
            }
        }
        return false;
View Full Code Here

     * Let's accumulate all the processing tasks.
     */
    do {
      for (final ProcessingEntry entry : processingTasksStack.pop()) {
        Class<? extends Annotation> annoClass = entry.annotationClass;
        Target target = annoClass.getAnnotation(Target.class);

        if (target == null) {
          target = new Target() {
            @Override
            public ElementType[] value() {
              return new ElementType[]
                      {ElementType.TYPE, ElementType.CONSTRUCTOR, ElementType.FIELD,
                              ElementType.METHOD, ElementType.FIELD};
            }

            @Override
            public Class<? extends Annotation> annotationType() {
              return Target.class;
            }
          };
        }

        for (ElementType elementType : target.value()) {
          final DependencyControlImpl dependencyControl = new DependencyControlImpl(processingTasksStack);

          switch (elementType) {
            case TYPE: {
              Set<Class<?>> classes;
View Full Code Here

        String fullName();
    }
    public static boolean isJAXB22() {
        Target t = XmlElement.class.getAnnotation(Target.class);
        //JAXB 2.2 allows XmlElement on params.
        for (ElementType et : t.value()) {
            if (et == ElementType.PARAMETER) {
                return true;
            }
        }
        return false;
View Full Code Here

        String fullName();
    }
    public static boolean isJAXB22() {
        Target t = XmlElement.class.getAnnotation(Target.class);
        //JAXB 2.2 allows XmlElement on params.
        for (ElementType et : t.value()) {
            if (et == ElementType.PARAMETER) {
                return true;
            }
        }
        return false;
View Full Code Here

     * Let's accumulate all the processing tasks.
     */
    do {
      for (final ProcessingEntry entry : processingTasksStack.pop()) {
        final Class<? extends Annotation> annotationClass = entry.annotationClass;
        Target target = annotationClass.getAnnotation(Target.class);

        if (target == null) {
          target = new Target() {
            @Override
            public ElementType[] value() {
              return new ElementType[]
                  {ElementType.TYPE, ElementType.CONSTRUCTOR, ElementType.FIELD,
                      ElementType.METHOD, ElementType.FIELD};
            }

            @Override
            public Class<? extends Annotation> annotationType() {
              return Target.class;
            }
          };
        }

        for (final ElementType elementType : target.value()) {
          final DependencyControlImpl dependencyControl = new DependencyControlImpl(processingTasksStack);

          switch (elementType) {
            case TYPE: {
              Collection<MetaClass> classes;
View Full Code Here

  }

  public void registerDecorator(final IOCDecoratorExtension<?> iocExtension) {
    final Class<? extends Annotation> annotation = iocExtension.decoratesWith();

    final Target target = annotation.getAnnotation(Target.class);
    if (target != null) {
      final boolean oneTarget = target.value().length == 1;

      for (final ElementType type : target.value()) {
        if (type == ElementType.ANNOTATION_TYPE) {
          // type is a meta-annotation. so we need to map all annotations with this
          // meta-annotation to the decorator extension.

          for (final MetaClass annotationClazz : ClassScanner.getTypesAnnotatedWith(annotation)) {
View Full Code Here

TOP

Related Classes of java.lang.annotation.Target

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.