Package org.jboss.metadata.spi.retrieval.basic

Examples of org.jboss.metadata.spi.retrieval.basic.BasicAnnotationsItem


   }

   @SuppressWarnings("unchecked")
   public AnnotationsItem retrieveAnnotations()
   {
      BasicAnnotationsItem result = cachedAnnotationsItem;
      if (result != null && result.isValid())
         return result;
     
      Map<String, BasicAnnotationItem<? extends Annotation>> temp = annotations;
      if (temp == null)
         return noAnnotations();
     
      Collection<BasicAnnotationItem<? extends Annotation>> values = temp.values();
      if (values.isEmpty())
         return noAnnotations();
     
      AnnotationItem<? extends Annotation>[] items = values.toArray(new AnnotationItem[values.size()]);
      result = new BasicAnnotationsItem(this, items);
      cachedAnnotationsItem = result;
      return result;
   }
View Full Code Here


   /**
    * Invalidate the annotations item
    */
   protected void invalidateAnnotationsItem()
   {
      BasicAnnotationsItem temp = cachedAnnotationsItem;
      if (temp != null)
      {
         temp.invalidate();
         cachedAnnotationsItem = null;
      }
   }
View Full Code Here

    *
    * @return no annotations
    */
   protected BasicAnnotationsItem noAnnotations()
   {
      BasicAnnotationsItem result = new BasicAnnotationsItem(this, BasicAnnotationsItem.NO_ANNOTATION_ITEMS);
      cachedAnnotationsItem = result;
      return result;
   }
View Full Code Here

      BasicAnnotationItem<TestAnnotation2> item2 = new BasicAnnotationItem<TestAnnotation2>(loader, annotation2);

      @SuppressWarnings("unchecked")
      AnnotationItem[] items = { item1, item2 };
     
      @SuppressWarnings("unchecked")
      BasicAnnotationsItem item = new BasicAnnotationsItem(loader, items);
      AnnotationItem<? extends Annotation>[] result = item.getAnnotations();
      assertUnorderedArrayEquals(items, result);

      Annotation[] expected = { annotation1, annotation2 };
      Annotation[] annotations = item.getValue();
      assertUnorderedArrayEquals(expected, annotations);

      assertTrue(item.isCachable());
      assertTrue(item.isValid());
     
      loader.setCachable(false);
      assertFalse(item.isCachable());
      assertTrue(item.isValid());
     
      item1.invalidate();
      assertFalse(item.isCachable());
      assertFalse(item.isValid());
   }
View Full Code Here

   @SuppressWarnings("unchecked")
   protected <T extends Annotation> void setAnnotations(TestMetaDataLoader loader, AnnotationItem<T> annotationItem)
   {
      AnnotationItem[] items = { annotationItem };
      BasicAnnotationsItem item = new BasicAnnotationsItem(loader, items);
      loader.setAnnotationsItem(item);
   }
View Full Code Here

   @SuppressWarnings("unchecked")
   protected <T extends Annotation> void setAnnotations(TestMetaDataLoader loader, AnnotationItem<T> annotationItem)
   {
      AnnotationItem[] items = { annotationItem };
      BasicAnnotationsItem item = new BasicAnnotationsItem(loader, items);
      loader.setAnnotationsItem(item);
   }
View Full Code Here

      return cachable;
   }

   public AnnotationsItem retrieveAnnotations()
   {
      BasicAnnotationsItem result = cachedAnnotationsItem;
      if (result != null && result.isValid())
         return result;
     
      Map<String, BasicAnnotationItem> temp = annotations;
      if (temp == null)
         return noAnnotations();
     
      Collection<BasicAnnotationItem> values = temp.values();
      if (values.isEmpty())
         return noAnnotations();
     
      AnnotationItem[] items = values.toArray(new AnnotationItem[values.size()]);
      result = new BasicAnnotationsItem(this, items);
      cachedAnnotationsItem = result;
      return result;
   }
View Full Code Here

   /**
    * Invalidate the annotations item
    */
   protected void invalidateAnnotationsItem()
   {
      BasicAnnotationsItem temp = cachedAnnotationsItem;
      if (temp != null)
      {
         temp.invalidate();
         cachedAnnotationsItem = null;
      }
   }
View Full Code Here

    *
    * @return no annotations
    */
   protected BasicAnnotationsItem noAnnotations()
   {
      BasicAnnotationsItem result = new BasicAnnotationsItem(this, BasicAnnotationsItem.NO_ANNOTATION_ITEMS);
      cachedAnnotationsItem = result;
      return result;
   }
View Full Code Here

      return cachable;
   }

   public AnnotationsItem retrieveAnnotations()
   {
      BasicAnnotationsItem result = cachedAnnotationsItem;
      if (result != null && result.isValid())
         return result;
     
      Map<String, BasicAnnotationItem> temp = annotations;
      if (temp == null)
         return noAnnotations();
     
      Collection<BasicAnnotationItem> values = temp.values();
      if (values.isEmpty())
         return noAnnotations();
     
      AnnotationItem[] items = values.toArray(new AnnotationItem[values.size()]);
      result = new BasicAnnotationsItem(this, items);
      cachedAnnotationsItem = result;
      return result;
   }
View Full Code Here

TOP

Related Classes of org.jboss.metadata.spi.retrieval.basic.BasicAnnotationsItem

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.