Package org.jboss.metatype.api.values

Examples of org.jboss.metatype.api.values.TableValue


         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.getMetaType());
   }
View Full Code Here


         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.getMetaType());
   }
View Full Code Here

      // Assert
      ManagedProperty p = restored.getProperty("map");
      assertTrue(p.getValue() instanceof TableValue);
      assertTrue(p.getMetaType() instanceof TableMetaType);
     
      TableValue table = (TableValue) p.getValue();
      assertRow(table, 1, "one");
      assertRow(table, 2, "two");
      assertRow(table, 3, "three");
     
      SimpleTableMetaData metaData = (SimpleTableMetaData) restored.getAttachment();
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 }
      };
View Full Code Here

      CompositeValue compData2 = initCompositeValue2(data);
      CompositeValue compData3 = initCompositeValue4(data);

      data.putAll(new CompositeValue[] { compData, compData2, compData3 });

      TableValue clone = data.clone();
      assertEquals("Clone should have the same tabular type", data.getMetaType(), clone.getMetaType());
      assertEquals("Clone should have the same number of elements", data.size(), clone.size());
      CompositeValue compDataClone = clone.get(initValues());
      assertTrue("Should be a shallow clone", compData == compDataClone);
   }
View Full Code Here

      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")};
      CompositeValueSupport key1 = new CompositeValueSupport(keyType, new String[]{"key"}, keyValues1);
      MetaValue[] itemValues = new MetaValue[] {key1, SimpleValueSupport.wrap(new Integer(1)) };
      expected.put(new CompositeValueSupport(entryType, itemNames, itemValues));

      MetaValue[] keyValues2 = {SimpleValueSupport.wrap("Goodbye")};
      CompositeValueSupport key2 = new CompositeValueSupport(keyType, new String[]{"key"}, keyValues2);
      itemValues = new MetaValue[] { key2, SimpleValueSupport.wrap(new Integer(2)) };
      expected.put(new CompositeValueSupport(entryType, itemNames, itemValues));

      MetaValue result = createMetaValue(map, collectionType);
      TableValue actual = assertInstanceOf(result, TableValue.class);
     
      getLog().debug("Map Value: " + actual);
      assertEquals(expected, actual);
   }
View Full Code Here

      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());
      compositeType.addItem("something", "something", SimpleMetaType.STRING);
      compositeType.freeze();

      String[] compositeNames = { "something" };
      CompositeValue compositeValue = new CompositeValueSupport(compositeType, compositeNames, new MetaValue[] { SimpleValueSupport.wrap("Hello") });
     
      MetaValue[] itemValues = new MetaValue[] { compositeValue, SimpleValueSupport.wrap(new Integer(1)) };
      expected.put(new CompositeValueSupport(entryType, itemNames, itemValues));

      compositeValue = new CompositeValueSupport(compositeType, compositeNames, new MetaValue[] { SimpleValueSupport.wrap("Goodbye") });
      itemValues = new MetaValue[] { compositeValue, SimpleValueSupport.wrap(new Integer(2)) };
      expected.put(new CompositeValueSupport(entryType, itemNames, itemValues));

      MetaValue result = createMetaValue(map, collectionType);
      TableValue actual = assertInstanceOf(result, TableValue.class);
     
      getLog().debug("Map Value: " + actual);
      assertEquals(expected, actual);
   }
View Full Code Here

      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());
      compositeType.addItem("something", "something", SimpleMetaType.STRING);
      compositeType.freeze();

      String[] compositeNames = { "something" };
      CompositeValue compositeValue = new CompositeValueSupport(compositeType, compositeNames, new MetaValue[] { SimpleValueSupport.wrap("Hello") });
     
      MetaValue[] keyValues1 = {SimpleValueSupport.wrap("Hello")};
      CompositeValueSupport key1 = new CompositeValueSupport(keyType, new String[]{"key"}, keyValues1);
      MetaValue[] itemValues = new MetaValue[] { key1, compositeValue };
      expected.put(new CompositeValueSupport(entryType, itemNames, itemValues));

      MetaValue[] keyValues2 = {SimpleValueSupport.wrap("Goodbye")};
      CompositeValueSupport key2 = new CompositeValueSupport(keyType, new String[]{"key"}, keyValues2);
      compositeValue = new CompositeValueSupport(compositeType, compositeNames, new MetaValue[] { SimpleValueSupport.wrap("Goodbye") });
      itemValues = new MetaValue[] { key2, compositeValue };
      expected.put(new CompositeValueSupport(entryType, itemNames, itemValues));

      MetaValue result = createMetaValue(map, collectionType);
      TableValue actual = assertInstanceOf(result, TableValue.class);
     
      getLog().debug("Map Value: " + actual);
      assertEquals(expected, actual);
   }
View Full Code Here

         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.getMetaType());
   }
View Full Code Here

         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);
   }
View Full Code Here

TOP

Related Classes of org.jboss.metatype.api.values.TableValue

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.