Package org.jboss.metatype.api.types

Examples of org.jboss.metatype.api.types.ImmutableTableMetaType


   public TableMetaType createMapType(TypeInfo keyType, TypeInfo valueType)
   {
      String name = Map.class.getName();
      MetaType[] itemTypes = { resolve(keyType), resolve(valueType) };
      CompositeMetaType entryType = createMapEntryType(itemTypes);
      return new ImmutableTableMetaType(name, name, entryType, MAP_INDEX_NAMES);
   }
View Full Code Here


   public TableMetaType createMapType(TypeInfo keyType, TypeInfo valueType)
   {
      String name = Map.class.getName();
      MetaType[] itemTypes = { resolve(keyType), resolve(valueType) };
      CompositeMetaType entryType = createMapEntryType(itemTypes);
      return new ImmutableTableMetaType(name, name, entryType, MAP_INDEX_NAMES);
   }
View Full Code Here

   {
      String[] itemNames = new String[] { "name1", "name2" };
      String[] itemDescriptions = new String[] { "desc1", "desc2" };
      MetaType[] itemTypes = new MetaType[] { SimpleMetaType.STRING, SimpleMetaType.INTEGER };
      CompositeMetaType compositeType = new ImmutableCompositeMetaType("typeName", "description", itemNames, itemDescriptions, itemTypes);
      TableMetaType tableType = new ImmutableTableMetaType("typeName", "description", compositeType, new String[] { "name1" });
      TableValue tv = new MockTableValue(tableType);
      TableValue[][] tabData1 = new TableValue[][]
      {
         { tv, null }, { tv, tv }
      };

      ArrayMetaType tabArrayType1 = new ArrayMetaType(2, tableType);
      assertTrue("tabData1 should be a value of array type", tabArrayType1.isValue(tabData1));

      ArrayMetaType tabArrayType2 = new ArrayMetaType(1, tableType);
      assertFalse("tabData1 should not be a value of array type, wrong number of dimensions", tabArrayType2.isValue(tabData1));

      TableMetaType tableType2 = new ImmutableTableMetaType("typeName2", "description", compositeType, new String[] { "name1" });
      ArrayMetaType tabArrayType3 = new ArrayMetaType(2, tableType2);
      assertFalse("tabData1 should not be a value of array type, wrong element type", tabArrayType3.isValue(tabData1));
   }
View Full Code Here

      CompositeMetaType keyType = (CompositeMetaType) resolve(StringKey.class);
      MetaType valueType = resolve(Integer.class);
      MetaType[] itemTypes = { keyType, valueType };
      String entryName = Map.Entry.class.getName();
      CompositeMetaType entryType = new ImmutableCompositeMetaType(entryName, entryName, DefaultMetaTypeFactory.MAP_ITEM_NAMES, DefaultMetaTypeFactory.MAP_ITEM_NAMES, itemTypes);
      TableMetaType tableType = new ImmutableTableMetaType(Map.class.getName(), Map.class.getName(), entryType, DefaultMetaTypeFactory.MAP_INDEX_NAMES);
     
      TableValue expected = new TableValueSupport(tableType);
      String[] itemNames = DefaultMetaTypeFactory.MAP_ITEM_NAMES;
     
      MetaValue[] keyValues1 = {SimpleValueSupport.wrap("Hello")};
View Full Code Here

      MetaType keyType = resolve(TestSimpleComposite.class);
      MetaType valueType = resolve(Integer.class);
      MetaType[] itemTypes = { keyType, valueType };
      String entryName = Map.Entry.class.getName();
      CompositeMetaType entryType = new ImmutableCompositeMetaType(entryName, entryName, DefaultMetaTypeFactory.MAP_ITEM_NAMES, DefaultMetaTypeFactory.MAP_ITEM_NAMES, itemTypes);
      TableMetaType tableType = new ImmutableTableMetaType(Map.class.getName(), Map.class.getName(), entryType, DefaultMetaTypeFactory.MAP_INDEX_NAMES);
     
      TableValue expected = new TableValueSupport(tableType);
      String[] itemNames = DefaultMetaTypeFactory.MAP_ITEM_NAMES;
     
      MutableCompositeMetaType compositeType = new MutableCompositeMetaType(TestSimpleComposite.class.getName(), TestSimpleComposite.class.getName());
View Full Code Here

      CompositeMetaType keyType = (CompositeMetaType) resolve(StringKey.class);
      MetaType valueType = resolve(TestSimpleComposite.class);
      MetaType[] itemTypes = { keyType, valueType };
      String entryName = Map.Entry.class.getName();
      CompositeMetaType entryType = new ImmutableCompositeMetaType(entryName, entryName, DefaultMetaTypeFactory.MAP_ITEM_NAMES, DefaultMetaTypeFactory.MAP_ITEM_NAMES, itemTypes);
      TableMetaType tableType = new ImmutableTableMetaType(Map.class.getName(), Map.class.getName(), entryType, DefaultMetaTypeFactory.MAP_INDEX_NAMES);
     
      TableValue expected = new TableValueSupport(tableType);
      String[] itemNames = DefaultMetaTypeFactory.MAP_ITEM_NAMES;
     
      MutableCompositeMetaType compositeType = new MutableCompositeMetaType(TestSimpleComposite.class.getName(), TestSimpleComposite.class.getName());
View Full Code Here

   protected TableMetaType initTableType()
   {
      CompositeMetaType rowType = initCompositeMetaType();

      String[] indexNames = new String[] { "name1", "name2" };
      TableMetaType tableType = new ImmutableTableMetaType("typeName", "description", rowType, indexNames);
      return tableType;
   }
View Full Code Here

   protected TableMetaType initTableType2()
   {
      CompositeMetaType rowType = initCompositeMetaType();

      String[] indexNames = new String[] { "name1", "name2" };
      TableMetaType tableType = new ImmutableTableMetaType("typeName2", "description", rowType, indexNames);
      return tableType;
   }
View Full Code Here

      CompositeMetaType rowType = initRowType();
      String[] indexNames = new String[] { "name1", "name2" };

      try
      {
         new ImmutableTableMetaType(null, "description", rowType, indexNames);
         fail("Expected IllegalArgumentException for null type name");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }

      try
      {
         new ImmutableTableMetaType("", "description", rowType, indexNames);
         fail("Expected IllegalArgumentException for empty type name");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }

      try
      {
         new ImmutableTableMetaType("typeName", null, rowType, indexNames);
         fail("Expected IllegalArgumentException for null description");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }

      try
      {
         new ImmutableTableMetaType("typeName", "", rowType, indexNames);
         fail("Expected IllegalArgumentException for empty description");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }

      try
      {
         new ImmutableTableMetaType("typeName", "description", null, indexNames);
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }

      try
      {
         new ImmutableTableMetaType("typeName", "description", rowType, null);
         fail("Expected IllegalArgumentException for null row type");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }

      try
      {
         new ImmutableTableMetaType("typeName", "description", rowType, new String[0]);
         fail("Expected IllegalArgumentException for empty index names");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }

      try
      {
         new ImmutableTableMetaType("typeName", "description", rowType, new String[] { "name1", null });
         fail("Expected IllegalArgumentException for null index name element");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }

      try
      {
         new ImmutableTableMetaType("typeName", "description", rowType, new String[] { "name1", "" });
         fail("Expected IllegalArgumentException for empty index name element");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
      }

      try
      {
         new ImmutableTableMetaType("typeName", "description", rowType, new String[] { "name1", "nameX" });
         fail("Expected IllegalArgumentException for invalid index name");
      }
      catch (Throwable t)
      {
         checkThrowable(IllegalArgumentException.class, t);
View Full Code Here

   protected TableMetaType initTableMetaType() throws Exception
   {
      CompositeMetaType rowType = initRowType();

      String[] indexNames = new String[] { "name1", "name2" };
      TableMetaType tableType = new ImmutableTableMetaType("typeName", "description", rowType, indexNames);
      return tableType;
   }
View Full Code Here

TOP

Related Classes of org.jboss.metatype.api.types.ImmutableTableMetaType

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.