Examples of AnnotationsItem


Examples of org.jboss.metadata.spi.retrieval.AnnotationsItem

      return retrieveMetaData();
   }

   public MetaDatasItem retrieveMetaData()
   {
      AnnotationsItem annotations = retrieveAnnotations();
      return new AnnotationsToMetaDatasBridge(annotations);
   }
View Full Code Here

Examples of org.jboss.metadata.spi.retrieval.AnnotationsItem

   }

   @SuppressWarnings("unchecked")
   public MetaDataItem<?> retrieveMetaData(String name)
   {
      AnnotationsItem annotations = retrieveAnnotations();
      for (AnnotationItem annotation : annotations.getAnnotations())
      {
         if (annotation.getName().equals(name))
            return new AnnotationToMetaDataBridge(annotation);
      }
      return null;
View Full Code Here

Examples of org.jboss.metadata.spi.retrieval.AnnotationsItem

   protected void assertAnnotations(MetaDataRetrieval metaData, ExpectedAnnotations expected) throws Exception
   {
      assertNotNull(metaData);
      assertNotNull(expected);
     
      AnnotationsItem result = metaData.retrieveAnnotations();
      assertNotNull("Null result", result);
      AnnotationItem<? extends Annotation>[] items = result.getAnnotations();
      assertNotNull("Null items", items);
      ExpectedAnnotations actual = emptyExpectedAnnotations();
      for (AnnotationItem<? extends Annotation> item : items)
      {
         assertNotNull("Null annotation item " + Arrays.asList(items), item);
View Full Code Here

Examples of org.jboss.metadata.spi.retrieval.AnnotationsItem

   protected void assertLocalAnnotations(MetaDataRetrieval metaData, ExpectedAnnotations expected) throws Exception
   {
      assertNotNull(metaData);
      assertNotNull(expected);
     
      AnnotationsItem result = metaData.retrieveLocalAnnotations();
      assertNotNull("Null result", result);
      AnnotationItem<? extends Annotation>[] items = result.getAnnotations();
      assertNotNull("Null items", items);
      ExpectedAnnotations actual = emptyExpectedAnnotations();
      for (AnnotationItem<? extends Annotation> item : items)
      {
         assertNotNull("Null annotation item " + Arrays.asList(items), item);
View Full Code Here

Examples of org.jboss.metadata.spi.retrieval.AnnotationsItem

      else
         retrievals = context.getLocalRetrievals();
     
      for (MetaDataRetrieval retrieval : retrievals)
      {
         AnnotationsItem item = retrieval.retrieveAnnotations();
         if (item != null)
         {
            AnnotationItem<? extends Annotation>[] items = item.getAnnotations();
            for (AnnotationItem<? extends Annotation> it : items)
            {
               if (temp == null)
                  temp = new HashSet<AnnotationItem<? extends Annotation>>();
               temp.add(it);
View Full Code Here

Examples of org.jboss.metadata.spi.retrieval.AnnotationsItem

   public AnnotationsItem retrieveAnnotations()
   {
      if (cachedAnnotationsItem == null)
         cachedAnnotationsItem = factory.createCacheItem(AnnotationsItem.class, getFqn());

      AnnotationsItem item = cachedAnnotationsItem.get();
      if (item == null)
      {
         item = super.retrieveAnnotations();
         cachedAnnotationsItem.put(item);
      }
View Full Code Here

Examples of org.jboss.metadata.spi.retrieval.AnnotationsItem

      AbstractMetaDataContext parent = new AbstractMetaDataContext(parentLoader);
     
      MutableMetaDataLoader childLoader = createTestMutableMetaDataLoader();
      AbstractMetaDataContext child = new AbstractMetaDataContext(parent, childLoader);

      AnnotationsItem item = child.retrieveAnnotations();
     
      assertTrue(item.getAnnotations().length == 0);
      assertTrue(item.getValue().length == 0);
      assertTrue(item.isCachable());
      assertTrue(item.isValid());
     
      TestAnnotation1Impl annotation1 = new TestAnnotation1Impl();
      parentLoader.addAnnotation(annotation1);
      AnnotationItem<? extends Annotation> annotationItem1Parent = parentLoader.retrieveAnnotation(TestAnnotation1.class);

      @SuppressWarnings("unchecked")
      AnnotationItem[] expectedItems = { annotationItem1Parent };
      assertUnorderedArrayEquals(expectedItems, item.getAnnotations());
      Annotation[] expected = { annotation1 };
      assertUnorderedArrayEquals(expected, item.getValue());
     
      TestAnnotation2Impl annotation2 = new TestAnnotation2Impl();
      childLoader.addAnnotation(annotation2);
      AnnotationItem<? extends Annotation> annotationItem2Child = childLoader.retrieveAnnotation(TestAnnotation2.class);

      expectedItems = new AnnotationItem[] { annotationItem1Parent, annotationItem2Child };
      assertUnorderedArrayEquals(expectedItems, item.getAnnotations());
      expected = new Annotation[] { annotation1, annotation2 };
      assertUnorderedArrayEquals(expected, item.getValue());
     
      TestAnnotation1Impl annotation1Child = new TestAnnotation1Impl();
      childLoader.addAnnotation(annotation1Child);
      AnnotationItem<? extends Annotation> annotationItem1Child = childLoader.retrieveAnnotation(TestAnnotation1.class);

      expectedItems = new AnnotationItem[] { annotationItem1Child, annotationItem2Child };
      assertUnorderedArrayEquals(expectedItems, item.getAnnotations());
      expected = new Annotation[] { annotation1Child, annotation2 };
      assertUnorderedArrayEquals(expected, item.getValue());
     
      childLoader.removeAnnotation(TestAnnotation1.class);

      expectedItems = new AnnotationItem[] { annotationItem1Parent, annotationItem2Child };
      assertUnorderedArrayEquals(expectedItems, item.getAnnotations());
      expected = new Annotation[] { annotation1, annotation2 };
      assertUnorderedArrayEquals(expected, item.getValue());

      parentLoader.removeAnnotation(TestAnnotation1.class);

      expectedItems = new AnnotationItem[] { annotationItem2Child };
      assertUnorderedArrayEquals(expectedItems, item.getAnnotations());
      expected = new Annotation[] { annotation2 };
      assertUnorderedArrayEquals(expected, item.getValue());
     
      childLoader.removeAnnotation(TestAnnotation2.class);

      assertTrue(item.getAnnotations().length == 0);
      assertTrue(item.getValue().length == 0);
   }
View Full Code Here

Examples of org.jboss.metadata.spi.retrieval.AnnotationsItem

      assertTrue(item.isValid());
   }

   public void testNoSimpleAnnotations() throws Exception
   {
      AnnotationsItem item = SimpleAnnotationsItem.NO_ANNOTATIONS;

      AnnotationItem<? extends Annotation>[] items = item.getAnnotations();
      assertNotNull(items);
      assertEquals(0, items.length);

      Annotation[] annotations = item.getValue();
      assertNotNull(annotations);
      assertEquals(0, annotations.length);

      assertTrue(item.isCachable());
      assertTrue(item.isValid());
   }
View Full Code Here

Examples of org.jboss.metadata.spi.retrieval.AnnotationsItem

      return retrieveMetaData();
   }

   public MetaDatasItem retrieveMetaData()
   {
      AnnotationsItem annotations = retrieveAnnotations();
      return new AnnotationsToMetaDatasBridge(annotations);
   }
View Full Code Here

Examples of org.jboss.metadata.spi.retrieval.AnnotationsItem

      else
         retrievals = context.getLocalRetrievals();
     
      for (MetaDataRetrieval retrieval : retrievals)
      {
         AnnotationsItem item = retrieval.retrieveAnnotations();
         if (item != null)
         {
            AnnotationItem[] items = item.getAnnotations();
            for (AnnotationItem it : items)
            {
               if (temp == null)
                  temp = new HashSet<AnnotationItem>();
               temp.add(it);
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.