Package java.lang.annotation

Examples of java.lang.annotation.Annotation.annotationType()


     * an annotation presented on the element1.
     */
    public void testGetAnnotation() throws Throwable {
        Annotation an = getElement1().getAnnotation(TagAntn.class);
        assertNotNull(an);
        assertSame(TagAntn.class, an.annotationType());
    }
   
    /**
     * getAnnotation(Class) should return
     * an annotation presented on the element2.
View Full Code Here


     * an annotation presented on the element2.
     */
    public void testGetAnnotation2() throws Throwable {
        Annotation an = getElement2().getAnnotation(ValAntn.class);
        assertNotNull(an);
        assertSame(ValAntn.class, an.annotationType());
    }

    /**
     * getAnnotation(Class) should return
     * null for unexpected annotation type.
View Full Code Here

            for (Entry<Key<?>, Binding<?>> e : container.getBindings().entrySet()) {
                if (type.isAssignableFrom(e.getKey().getTypeLiteral().getRawType())) {
                    Annotation a = annotations.get(e.getKey());
                    Object o = e.getValue().getProvider().get();
                    if (o!=null) {
                        GuiceExtensionAnnotation gea = a!=null ? extensionAnnotations.get(a.annotationType()) : null;
                        result.add(new ExtensionComponent<U>(type.cast(o),gea!=null?gea.getOrdinal(a):0));
                    }
                }
            }
        }
View Full Code Here

        assertTrue(classTool.getAnnotations().isEmpty());
        classTool.setType(MyDeprecated.class);
        assertEquals(1, classTool.getAnnotations().size());
        classTool.setType(ValueParser.class);
        Annotation defaultKey = classTool.getAnnotations().get(0);
        assertEquals(defaultKey.annotationType(), DefaultKey.class);
    }

    public @Test void methodGetConstructors() throws Exception
    {
        ClassTool classTool = new ClassTool();
View Full Code Here

    public void set( Object metaInfo )
    {
        if( metaInfo instanceof Annotation )
        {
            Annotation annotation = (Annotation) metaInfo;
            metaInfoMap.put( annotation.annotationType(), metaInfo );
        }
        else
        {
            Class<?> metaInfoclass = metaInfo.getClass();
            Iterable<Type> types = Classes.TYPES_OF.map( metaInfoclass );
View Full Code Here

        // TODO This could be changed to allow multiple @Qualifier annotations
        Annotation qualifierAnnotation = first( filter( Specifications.translate( Annotations.type(), hasAnnotation( Qualifier.class ) ), iterable( dependencyModel.annotations() ) ) );
        Specification<ServiceReference<?>> serviceQualifier = null;
        if( qualifierAnnotation != null )
        {
            Qualifier qualifier = qualifierAnnotation.annotationType().getAnnotation( Qualifier.class );
            try
            {
                serviceQualifier = qualifier.value().newInstance().qualifier( qualifierAnnotation );
            }
            catch( Exception e )
View Full Code Here

  @Inject private BeanManager beanManager;

  protected Class< ? extends ScopedAssociation> getBroadestActiveContext() {
    for (Class< ? extends ScopedAssociation> scopeType : getAvailableScopedAssociationClasses()) {
      Annotation scopeAnnotation = scopeType.getAnnotations().length > 0 ? scopeType.getAnnotations()[0] : null;
      if (scopeAnnotation == null || !beanManager.isScope(scopeAnnotation.annotationType())) {
        throw new ProcessEngineException("ScopedAssociation must carry exactly one annotation and it must be a @Scope annotation");
      }
      try {
        beanManager.getContext(scopeAnnotation.annotationType());
        return scopeType;
View Full Code Here

      Annotation scopeAnnotation = scopeType.getAnnotations().length > 0 ? scopeType.getAnnotations()[0] : null;
      if (scopeAnnotation == null || !beanManager.isScope(scopeAnnotation.annotationType())) {
        throw new ProcessEngineException("ScopedAssociation must carry exactly one annotation and it must be a @Scope annotation");
      }
      try {
        beanManager.getContext(scopeAnnotation.annotationType());
        return scopeType;
      } catch (ContextNotActiveException e) {
        log.finest("Context " + scopeAnnotation.annotationType() + " not active.");
      }
    }
View Full Code Here

      }
      try {
        beanManager.getContext(scopeAnnotation.annotationType());
        return scopeType;
      } catch (ContextNotActiveException e) {
        log.finest("Context " + scopeAnnotation.annotationType() + " not active.");
      }
    }
    throw new ProcessEngineException("Could not determine an active context to associate the current process instance / task instance with.");
  }
View Full Code Here

         if (annotationMetaData != null)
         {
            for (AnnotationMetaData annMeta : annotationMetaData)
            {
               Annotation ann = annMeta.getAnnotationInstance();
               if (ann.annotationType() == InterceptMC.class)
               {
                  interceptAnnotation = (InterceptMC) ann;
               }
            }
         }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.