[jboss-cvs] JBossAS SVN: r68126 - projects/microcontainer/trunk/metatype/src/main/org/jboss/metatype/plugins/values.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Dec 10 20:04:56 EST 2007


Author: alesj
Date: 2007-12-10 20:04:55 -0500 (Mon, 10 Dec 2007)
New Revision: 68126

Modified:
   projects/microcontainer/trunk/metatype/src/main/org/jboss/metatype/plugins/values/DefaultMetaValueFactory.java
Log:
TODO on table unwrap.

Modified: projects/microcontainer/trunk/metatype/src/main/org/jboss/metatype/plugins/values/DefaultMetaValueFactory.java
===================================================================
--- projects/microcontainer/trunk/metatype/src/main/org/jboss/metatype/plugins/values/DefaultMetaValueFactory.java	2007-12-11 00:40:25 UTC (rev 68125)
+++ projects/microcontainer/trunk/metatype/src/main/org/jboss/metatype/plugins/values/DefaultMetaValueFactory.java	2007-12-11 01:04:55 UTC (rev 68126)
@@ -74,6 +74,7 @@
 /**
  * DefaultMetaValueFactory.
  * 
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision: 1.1 $
  */
@@ -429,7 +430,7 @@
       CompositeMetaType entryType = type.getRowType();
       MetaType keyType = entryType.getType(DefaultMetaTypeFactory.MAP_KEY);
       MetaType valType = entryType.getType(DefaultMetaTypeFactory.MAP_VALUE);
-      
+
       for (Iterator<Map.Entry> i = value.entrySet().iterator(); i.hasNext();)
       {
          Map.Entry entry = i.next();
@@ -438,7 +439,7 @@
          CompositeValueSupport data = new CompositeValueSupport(entryType, DefaultMetaTypeFactory.MAP_ITEM_NAMES, new MetaValue[] { key, val });
          table.put(data);
       }
-      
+
       return table;
    }
    
@@ -493,6 +494,7 @@
          return null;
 
       MetaType metaType = metaValue.getMetaType();
+      // TODO - impl this support as well
       if (metaType.isTable())
          throw new IllegalArgumentException("Cannot get value from " + metaValue + ", unsupported.");
 
@@ -539,6 +541,11 @@
          CollectionValue collectionValue = (CollectionValue)metaValue;
          return unwrapCollection(collectionValue, type);
       }
+      else if (metaType.isTable())
+      {
+         TableValue tableValue = (TableValue)metaValue;
+         return unwrapTable(tableValue, type);
+      }
 
       throw new IllegalArgumentException("Unsupported meta value: " + metaValue);
    }
@@ -661,6 +668,7 @@
     * @param type the type info
     * @return unwrapped collection
     */
+   @SuppressWarnings("unchecked")
    protected Object unwrapCollection(CollectionValue collectionValue, TypeInfo type)
    {
       try
@@ -695,6 +703,19 @@
    }
 
    /**
+    * Unwrap table meta value.
+    *
+    * @param tableValue the table value
+    * @param type the type info
+    * @return unwrapped table (map)
+    */
+   protected Object unwrapTable(TableValue tableValue, TypeInfo type)
+   {
+      // TODO - impl
+      return null;
+   }
+
+   /**
     * Create new instance.
     *
     * @param beanInfo the bean info
@@ -703,7 +724,7 @@
     */
    protected Object createNewInstance(BeanInfo beanInfo) throws Throwable
    {
-      // todo - some 'instantiator' map?
+      // TODO - some 'instantiator' map, which knows how to instantiate beaninfo (non default constructor)?
       return beanInfo.newInstance();
    }
 




More information about the jboss-cvs-commits mailing list