[jboss-cvs] microkernel/src/main/org/jboss/beans/metadata/plugins ...

Kabir Khan kkhan at jboss.com
Wed Jul 19 14:19:58 EDT 2006


  User: kkhan   
  Date: 06/07/19 14:19:58

  Modified:    src/main/org/jboss/beans/metadata/plugins  
                        AbstractAnnotationMetaData.java
  Removed:     src/main/org/jboss/beans/metadata/plugins  
                        AbstractAnnotationAttributeMetaData.java
  Log:
  [JBMICROCONT-98] Make the annotation metadata more free format
  
  Revision  Changes    Path
  1.7       +31 -43    microkernel/src/main/org/jboss/beans/metadata/plugins/AbstractAnnotationMetaData.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AbstractAnnotationMetaData.java
  ===================================================================
  RCS file: /cvsroot/jboss/microkernel/src/main/org/jboss/beans/metadata/plugins/AbstractAnnotationMetaData.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- AbstractAnnotationMetaData.java	23 Jun 2006 10:07:10 -0000	1.6
  +++ AbstractAnnotationMetaData.java	19 Jul 2006 18:19:58 -0000	1.7
  @@ -21,10 +21,11 @@
   */
   package org.jboss.beans.metadata.plugins;
   
  +import java.lang.annotation.Annotation;
   import java.util.Iterator;
  -import java.util.Set;
   
  -import org.jboss.beans.metadata.spi.AnnotationAttributeMetaData;
  +import org.jboss.annotation.factory.AnnotationCreator;
  +import org.jboss.annotation.factory.ast.TokenMgrError;
   import org.jboss.beans.metadata.spi.AnnotationMetaData;
   import org.jboss.beans.metadata.spi.MetaDataVisitor;
   import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
  @@ -35,15 +36,13 @@
    * Metadata for an annotation.
    * 
    * @author <a href="adrian at jboss.com">Adrian Brock</a>
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    */
   public class AbstractAnnotationMetaData extends JBossObject implements AnnotationMetaData
   {
  -   /** The annotation class name */
  -   protected String name;
  +   public String annotation;
      
  -   /** The attributes Set<AnnotationAttributeMetaData> */
  -   protected Set<AnnotationAttributeMetaData> attributes;
  +   protected Annotation ann;
   
      /**
       * Create a new annotation meta data
  @@ -53,36 +52,33 @@
         super();
      }
   
  -   /**
  -    * Set the name.
  -    * 
  -    * @param name The name to set.
  -    */
  -   public void setName(String name)
  +   public String getAnnotation()
      {
  -      this.name = name;
  -      flushJBossObjectCache();
  +      return annotation;
      }
      
  -   /**
  -    * Set the attributes.
  -    * 
  -    * @param attributes Set<AnnotationAttributeMetaData>
  -    */
  -   public void setAttributes(Set<AnnotationAttributeMetaData> attributes)
  +   public void setAnnotation(String annotation)
      {
  -      this.attributes = attributes;
  -      flushJBossObjectCache();
  +      this.annotation = annotation;
      }
   
  -   public String getName()
  +   public Annotation getAnnotationInstance()
  +   {
  +      try
      {
  -      return name;
  +         //FIXME [JBMICROCONT-99] [JBAOP-278] Use the loader for the bean?
  +         ann = (Annotation)AnnotationCreator.createAnnotation(annotation, Thread.currentThread().getContextClassLoader());
      }
  -
  -   public Set<AnnotationAttributeMetaData> getAttributes()
  +      catch (Exception e)
  +      {
  +         throw new RuntimeException("Error creating annotation for " + annotation, e);
  +      }
  +      catch(TokenMgrError e)
      {
  -      return attributes;
  +         throw new RuntimeException("Error creating annotation for " + annotation, e);
  +      }
  +      
  +      return ann;
      }
   
      public void visit(MetaDataVisitor visitor)
  @@ -92,24 +88,16 @@
      
      public Iterator<? extends MetaDataVisitorNode> getChildren()
      {
  -      if (attributes == null)
            return null;
  -      else
  -         return attributes.iterator();
      }
      
      public void toString(JBossStringBuilder buffer)
      {
  -      buffer.append("name=").append(name);
  -      if (attributes != null)
  -      {
  -         buffer.append(" attributes=");
  -         JBossObject.list(buffer, attributes);
  -      }
  +      buffer.append("expr=").append(ann);
      }
      
      public void toShortString(JBossStringBuilder buffer)
      {
  -      buffer.append(name);
  +      buffer.append(ann);
      }
   }
  
  
  



More information about the jboss-cvs-commits mailing list