Package org.jboss.metatype.api.types

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


            return moArrayValue;
         }
      }
      else if (propertyType.isCollection())
      {
         CollectionMetaType collectionType = CollectionMetaType.class.cast(propertyType);
         if (AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE == collectionType.getElementType())
         {
            List<GenericValue> tmp = getManagedObjectArray(beanInfo, property, metaData, value);
            GenericValue[] mos = new GenericValue[tmp.size()];
            CollectionMetaType moType = new CollectionMetaType(propertyType.getClassName(), AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
            tmp.toArray(mos);
            return new CollectionValueSupport(moType, mos);
         }
      }
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

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

               {
                  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

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

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

         {
            ManagedProperty deployments = mcfdgMO.getProperty("deployments");
            MetaType propType = deployments.getMetaType();
            if (propType.isCollection())
            {
               CollectionMetaType amt = (CollectionMetaType) propType;
               MetaType etype = amt.getElementType();
               if (etype == AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE)
               {
                  CollectionValue avalue = (CollectionValue) deployments.getValue();
                  if(avalue != null)
                  {
View Full Code Here

   public void testSimple(String methodName, Collection<String> collection) throws Exception
   {
      Method method = getClass().getMethod(methodName);
      Type type = method.getGenericReturnType();

      CollectionMetaType arrayType = assertInstanceOf(resolve(type), CollectionMetaType.class);
      MetaValue[] metaArray = { SimpleValueSupport.wrap("Hello"), SimpleValueSupport.wrap("Goodbye") };
      CollectionValueSupport expected = new CollectionValueSupport(arrayType, metaArray);
     
      MetaValue result = createMetaValue(collection, type);
      CollectionValue actual = assertInstanceOf(result, CollectionValue.class);
View Full Code Here

   public void testComposite(String methodName, Collection<TestSimpleComposite> collection) throws Exception
   {
      Method method = getClass().getMethod(methodName);
      Type type = method.getGenericReturnType();
     
      CollectionMetaType arrayType = assertInstanceOf(resolve(type), CollectionMetaType.class);
      CompositeMetaType compositeType = assertInstanceOf(resolve(TestSimpleComposite.class), CompositeMetaType.class);
      String[] itemNames = { "something" };
      MetaValue[] itemValues = { SimpleValueSupport.wrap("Hello") };
      CompositeValue helloValue = new CompositeValueSupport(compositeType, itemNames, itemValues);
      itemValues = new MetaValue[] { SimpleValueSupport.wrap("Goodbye") };
View Full Code Here

   @SuppressWarnings("unchecked")
   public CollectionMetaType generateCollection(ClassInfo typeInfo)
   {
      TypeInfo elementType = typeInfo.getComponentType();
      MetaType elementMetaType = resolve(elementType);
      return new CollectionMetaType(typeInfo.getName(), elementMetaType);
   }
View Full Code Here

   protected void testCollection(String methodName, Type elementClass, Class collectionClass) throws Exception
   {
      Method method = getClass().getMethod(methodName);
      Type collectionType = method.getGenericReturnType();
      MetaType result = resolve(collectionType);
      CollectionMetaType actual = assertInstanceOf(result, CollectionMetaType.class);
      MetaType elementType = resolve(elementClass);
      CollectionMetaType expected = new CollectionMetaType(collectionClass.getName(), elementType);
      testCollection(expected, actual);
   }
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.