Package org.jboss.metatype.api.types

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


   public void testChar2DArray()
      throws Exception
   {
      char[][] array = {{'H', 'e', 'l', 'l', 'o'}};
      MetaType result = resolve(array.getClass());
      ArrayMetaType actual = assertInstanceOf(result, ArrayMetaType.class);
      ArrayMetaType expected = new ArrayMetaType(2, SimpleMetaType.CHARACTER_PRIMITIVE);
      testArray(expected, actual);
   }
View Full Code Here


   public void testSimpleCompositeArray() throws Exception
   {
      TestSimpleComposite[] array = new TestSimpleComposite[0];
      MetaType result = resolve(array.getClass());
      MetaType composite = resolve(TestSimpleComposite.class);
      ArrayMetaType actual = assertInstanceOf(result, ArrayMetaType.class);
      ArrayMetaType expected = new ArrayMetaType(1, composite);
      testArray(expected, actual);
   }
View Full Code Here

   @SuppressWarnings("unchecked")
   public void testMultiSimpleArray() throws Exception
   {
      String[][] array = new String[0][0];
      MetaType result = resolve(array.getClass());
      ArrayMetaType actual = assertInstanceOf(result, ArrayMetaType.class);
      ArrayMetaType expected = new ArrayMetaType(2, SimpleMetaType.STRING);
      testArray(expected, actual);
   }
View Full Code Here

   public void testMultiSimpleCompositeArray() throws Exception
   {
      TestSimpleComposite[][] array = new TestSimpleComposite[0][0];
      MetaType result = resolve(array.getClass());
      MetaType composite = resolve(TestSimpleComposite.class);
      ArrayMetaType actual = assertInstanceOf(result, ArrayMetaType.class);
      ArrayMetaType expected = new ArrayMetaType(2, composite);
      testArray(expected, actual);
   }
View Full Code Here

               {
                  if (managed)
                  {
                     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;
                  }
View Full Code Here

            ManagedObject propMO = (ManagedObject) gv.getValue();
            processManagedObject(propMO, md);
         }
         else if (propType.isArray())
         {
            ArrayMetaType amt = (ArrayMetaType) propType;
            MetaType etype = amt.getElementType();
            if (etype == AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE)
            {
               ArrayValue avalue = (ArrayValue) prop.getValue();
               for(int n = 0; n < avalue.getLength(); n ++)
               {
                  GenericValue gv = (GenericValue) avalue.getValue(n);
                  ManagedObject propMO = (ManagedObject) gv.getValue();
                  processManagedObject(propMO, md);
               }
            }
         }
         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

                  Set<Object> bmdAliases = bmd.getAliases();
                  Map<String, ManagedProperty> oldProps = mmo.getProperties();
                  Map<String, ManagedProperty> newProps = new HashMap<String, ManagedProperty>(oldProps);
                  if(bmdAliases != null && bmdAliases.size() > 0)
                  {
                     ArrayMetaType aliasType = new ArrayMetaType(SimpleMetaType.STRING, false);
                     DefaultFieldsImpl fields = getFields("alias", aliasType);
                     fields.setDescription("Aliases of the bean");
                     String[] aliases = new String[bmdAliases.size()];
                     Iterator<?> i = bmdAliases.iterator();
                     for(int n = 0; i.hasNext(); n++)
View Full Code Here

      try
      {
         TypeInfoFactory tif = configuration.getTypeInfoFactory();
         if (metaType.isArray())
         {
            ArrayMetaType arrayMetaType = (ArrayMetaType)metaType;
            MetaType elementMetaType = arrayMetaType.getElementType();
            String elementTypeName = elementMetaType.getTypeName();
            if (arrayMetaType.isPrimitiveArray())
               elementTypeName = ArrayMetaType.getPrimitiveName(elementTypeName);
            TypeInfo elementTypeInfo = tif.getTypeInfo(elementTypeName, cl);
            int dimension = arrayMetaType.getDimension() - 1; // minus 1, since we already use first in next line
            TypeInfo typeInfo = elementTypeInfo.getArrayType();
            while(dimension > 0)
            {
               typeInfo = typeInfo.getArrayType();
               dimension--;
View Full Code Here

      {
         ++dimension;
         componentType = ((ArrayInfo) componentType).getComponentType();
      }
      MetaType componentMetaType = resolve(componentType);
      return new ArrayMetaType(dimension, componentMetaType, componentType.isPrimitive());
   }
View Full Code Here

         ManagedObject mo = mof.initManagedObject((Serializable) value, moName, moNameType);
         return new GenericValueSupport(AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE, mo);
      }
      else if (propertyType.isArray())
      {
         ArrayMetaType arrayType = ArrayMetaType.class.cast(propertyType);
         if (AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE == arrayType.getElementType())
         {
            Collection<?> cvalue = getAsCollection(value);
            ArrayMetaType moType = new ArrayMetaType(1, AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE);
            ArrayValueSupport moArrayValue = new ArrayValueSupport(moType);
            List<GenericValueSupport> tmp = new ArrayList<GenericValueSupport>();
            for(Object element : cvalue)
            {
               ManagedObject mo = mof.initManagedObject((Serializable) element, null, null);
View Full Code Here

TOP

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

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.