Package org.jboss.metatype.api.types

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


                  {
                     TypeInfo typeInfo = propertyInfo.getType();
                     if(typeInfo.isArray())
                        metaType = new ArrayMetaType(1, MANAGED_OBJECT_META_TYPE);
                     else if (typeInfo.isCollection())
                        metaType = new CollectionMetaType(typeInfo.getName(), MANAGED_OBJECT_META_TYPE);
                     else
                        metaType = MANAGED_OBJECT_META_TYPE;
                  }
                  else
                  {
View Full Code Here


   {
      MapCompositeMetaType etype = new MapCompositeMetaType(SimpleMetaType.STRING);
      etype.addItem("name", "the name of the bean");
      etype.addItem("value", "the string value of the bean");
      etype.addItem("type", "the type name of the value");
      type = new CollectionMetaType("java.util.List", etype);
   }
View Full Code Here

      assertTrue(gv2Value instanceof ManagedObject);
      ManagedObject mo2 = ManagedObject.class.cast(gv2Value);
      ManagedProperty properties = mo2.getProperty("properties");
      assertNotNull(properties);
      assertTrue(properties.getMetaType().isCollection());
      CollectionMetaType amt = (CollectionMetaType) properties.getMetaType();
      MetaType etype = amt.getElementType();
      if (etype == AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE)
      {
         CollectionValue avalue = (CollectionValue) properties.getValue();
         assertNotNull(avalue);
         MetaValue[] elements = avalue.getElements();
View Full Code Here

               }
            }
         }
         else if (propType.isCollection())
         {
            CollectionMetaType amt = (CollectionMetaType) propType;
            MetaType etype = amt.getElementType();
            if (etype == AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE)
            {
               CollectionValue avalue = (CollectionValue) prop.getValue();
               MetaValue[] elements = avalue.getElements();
               for(int n = 0; n < avalue.getSize(); n ++)
View Full Code Here

      // deployments
      ManagedProperty deployments = propsMap.get("deployments");
      assertNotNull(deployments);
      assertEquals("The DS connection factories", deployments.getDescription());
      MetaType deploymentsType = new CollectionMetaType(List.class.getName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
      assertEquals(deploymentsType, deployments.getMetaType());
      CollectionValue value = CollectionValue.class.cast(deployments.getValue());
      CollectionMetaType valueType = value.getMetaType();
      assertEquals(AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE, valueType.getElementType());

      assertEquals(1, value.getSize());
      // Validate the ConnMetaData ManagedObject
      GenericValue localConnMOGV = GenericValue.class.cast(value.getElements()[0]);
      ManagedObject localConnMO = ManagedObject.class.cast(localConnMOGV.getValue());
View Full Code Here

      // deployments
      ManagedProperty dsDeployments = propsMap.get("deployments");
      assertNotNull(deployments);
      assertEquals("The DS connection factories", dsDeployments.getDescription());
      MetaType deploymentsType = new CollectionMetaType(List.class.getName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
      assertEquals(deploymentsType, dsDeployments.getMetaType());
      CollectionValue value = CollectionValue.class.cast(dsDeployments.getValue());
      CollectionMetaType valueType = value.getMetaType();
      assertEquals(AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE, valueType.getElementType());

      assertEquals(2, value.getSize());
      ManagedObject localConnMO = null;
      ManagedObject xaConnMO = null;
      for(Object md : value)
View Full Code Here

      MetaData metaData = unit.getMetaData();
      // Update the beanFactories value to a list of BeanMetaDataFactory with BeanMetaDatas
      ManagedProperty beanFactoriesMP = deploymentMO.getProperty("beanFactories");
      List<GenericValue> tmpBFs = new ArrayList<GenericValue>();
      CollectionMetaType beansFactoryType = new CollectionMetaType(BeanMetaDataFactory.class.getName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
      if(beanFactories != null)
      {
         List<GenericValue> tmpBeans = new ArrayList<GenericValue>();
         CollectionMetaType beansType = new CollectionMetaType(BeanMetaDataFactory.class.getName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
         for(BeanMetaDataFactory bmdf : beanFactories)
         {
           
            ManagedObject bmdfMO = mof.initManagedObject(bmdf, metaData);
            if(bmdfMO == null)
View Full Code Here

               }
            }
         }
         else if(metaType.isCollection())
         {
            CollectionMetaType collectionMetaType = (CollectionMetaType) metaType;
            if(collectionMetaType.getElementType() == AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE)
            {
               // FIXME
               Collection<?> newCollection = unwrapGenericCollection((CollectionValue) value, propertyInfo);
               propertyInfo.set(attachment, newCollection);
               return;
View Full Code Here

      TypeInfo[] types = typeInfo.getActualTypeArguments();
      if (types != null)
         elementType = types[0];
     
      MetaType elementMetaType = resolve(elementType);
      return new CollectionMetaType(typeInfo.getName(), elementMetaType);
   }
View Full Code Here

            return moArrayValue;
         }
      }
      else if (propertyType.isCollection())
      {
         CollectionMetaType collectionType = CollectionMetaType.class.cast(propertyType);
         if (AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE == collectionType.getElementType())
         {
            Collection<?> cvalue = getAsCollection(value);
            List<GenericValueSupport> tmp = new ArrayList<GenericValueSupport>();
            for(Object element : cvalue)
            {
               ManagedObject mo = mof.initManagedObject((Serializable) element, null, null);
               tmp.add(new GenericValueSupport(AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE, mo));
            }
            GenericValueSupport[] mos = new GenericValueSupport[tmp.size()];
            CollectionMetaType moType = new CollectionMetaType(propertyType.getClassName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
            return new CollectionValueSupport(moType, tmp.toArray(mos));
         }
      }

      return metaValueFactory.create(value, propertyInfo.getType());
View Full Code Here

TOP

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

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.