Package org.jboss.metatype.api.types

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


   }

   protected Map unwrapCompositeMap(CompositeValue compositeValue)
   {
      HashMap map = new HashMap();
      CompositeMetaType metaType = compositeValue.getMetaType();
      for(String key : metaType.itemSet())
      {
         MetaValue mv = compositeValue.get(key);
         Object value = unwrap(mv);
         map.put(key, value);
      }
View Full Code Here


   }

   @Override
   public String toString()
   {
      CompositeMetaType metaType = getMetaType();
      StringBuilder buffer = new StringBuilder(getClass().getSimpleName());
      buffer.append(": metaType=[");
      buffer.append(metaType);
      buffer.append("] items=[");
      Iterator<String> keys = metaType.keySet().iterator();
      while(keys.hasNext())
      {
         Object key = keys.next();
         buffer.append(key).append("=");
         Object value = contents.get(key);
View Full Code Here

    */
   private MetaType validateKey(String key)
   {
      if (key == null || key.length() == 0)
         throw new IllegalArgumentException("null or empty key");
      CompositeMetaType metaType = getMetaType();
      MetaType result = metaType.getType(key);
      if (result == null)
         throw new IllegalArgumentException("no such item name " + key + " for composite type " + metaType);
      return result;
   }
View Full Code Here

   @SuppressWarnings("unchecked")
   private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
   {
      ObjectInputStream.GetField getField = in.readFields();
      SortedMap contents = (SortedMap) getField.get("contents", null);
      CompositeMetaType compositeType = (CompositeMetaType) getField.get("metaType", null);
      try
      {
         init(compositeType, contents);
      }
      catch (Exception e)
View Full Code Here

    * @throws Exception for any problem
    */
   public void testSimpleComposite() throws Exception
   {
      MetaType result = resolve(TestSimpleComposite.class);
      CompositeMetaType actual = assertInstanceOf(result, CompositeMetaType.class);
     
      MutableCompositeMetaType expected = new MutableCompositeMetaType(TestSimpleComposite.class.getName(), TestSimpleComposite.class.getName());
      expected.addItem("something", "something", SimpleMetaType.STRING);
      expected.freeze();
     
View Full Code Here

    * @throws Exception for any problem
    */
   public void testRecursiveComposite() throws Exception
   {
      MetaType result = resolve(TestRecursiveComposite.class);
      CompositeMetaType actual = assertInstanceOf(result, CompositeMetaType.class);
     
      MutableCompositeMetaType expected = new MutableCompositeMetaType(TestRecursiveComposite.class.getName(), TestRecursiveComposite.class.getName());
      expected.addItem("id", "id", SimpleMetaType.STRING);
      expected.addItem("other", "other", expected);
      Set<String> keys = Collections.singleton("id");
View Full Code Here

   }
  
   public void testIgnoredItem() throws Exception
   {
      MetaType result = resolve(TestIgnoredCompositeItem.class);
      CompositeMetaType actual = assertInstanceOf(result, CompositeMetaType.class);

      MutableCompositeMetaType expected = new MutableCompositeMetaType(TestIgnoredCompositeItem.class.getName(), TestIgnoredCompositeItem.class.getName());
      expected.addItem("id", "id", SimpleMetaType.STRING);
      Set<String> keys = Collections.singleton("id");
      expected.setKeys(keys);
View Full Code Here

   }
  
   public void testRenamedItem() throws Exception
   {
      MetaType result = resolve(TestRenamedCompositeItem.class);
      CompositeMetaType actual = assertInstanceOf(result, CompositeMetaType.class);
     
      MutableCompositeMetaType expected = new MutableCompositeMetaType(TestRenamedCompositeItem.class.getName(), TestRenamedCompositeItem.class.getName());
      expected.addItem("id", "id", SimpleMetaType.STRING);
      expected.addItem("renamed", "renamed", SimpleMetaType.STRING);
      Set<String> keys = Collections.singleton("id");
View Full Code Here

   public void testMapWithStringKeyComposite() throws Exception
   {
      //Map<String,String> map = new HashMap<String,String>();
      Field field = getClass().getField("compositeSignature");
      Type mapSignature = field.getGenericType();
      CompositeMetaType result = assertInstanceOf(resolve(mapSignature), CompositeMetaType.class);
      MapCompositeMetaType expected = new MapCompositeMetaType(SimpleMetaType.STRING);
     
      testComposite(expected, result);
   }
View Full Code Here

    */
   public void testPropertiesComposite()
      throws Exception
   {
      Type propertiesType = Properties.class;
      CompositeMetaType result = assertInstanceOf(resolve(propertiesType), CompositeMetaType.class);
      MapCompositeMetaType expected = new MapCompositeMetaType(SimpleMetaType.STRING);
      testComposite(expected, result);
   }
View Full Code Here

TOP

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

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.