Examples of ArrayMetaType


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

   public void testCompositeArray() throws Exception
   {
      TestSimpleComposite hello = new TestSimpleComposite("Hello");
      TestSimpleComposite goodbye = new TestSimpleComposite("Goodbye");
      TestSimpleComposite[] array = { hello, goodbye };
      ArrayMetaType arrayType = assertInstanceOf(resolve(array.getClass()), ArrayMetaType.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

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

    */
   @SuppressWarnings("unchecked")
   public void testMultipleArray() throws Exception
   {
      String[][] array = { { "Hello" }, { "Goodbye" } };
      ArrayMetaType arrayType = assertInstanceOf(resolve(array.getClass()), ArrayMetaType.class);
      Object[][] metaArray = { { SimpleValueSupport.wrap("Hello") }, { SimpleValueSupport.wrap("Goodbye") } };
      ArrayValueSupport expected = new ArrayValueSupport(arrayType, metaArray);
     
      MetaValue result = createMetaValue(array);
      ArrayValue actual = assertInstanceOf(result, ArrayValue.class);
View Full Code Here

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

      return result;
   }

   public void testCharArray() throws Exception
   {
      ArrayMetaType type = new ArrayMetaType(1, SimpleMetaType.CHARACTER);
      char[] value = {'h', 'e', 'l', 'l', 'o'};
      ArrayValueSupport avs = new ArrayValueSupport(type, value);
      // Use getValue(int) accessor
      for(int n = 0; n < avs.getLength(); n ++)
      {
View Full Code Here

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

   }
  
   @SuppressWarnings("unchecked")
   public void testCharacterArray() throws Exception
   {
      ArrayMetaType type = new ArrayMetaType(1, SimpleMetaType.CHARACTER);
      Character[] value = {'h', 'e', 'l', 'l', 'o'};
      ArrayValueSupport avs = new ArrayValueSupport(type, value);
      for(int n = 0; n < avs.getLength(); n ++)
      {
         Object element = avs.getValue(n);
View Full Code Here

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

      }
   }

   public void test2DCharArray() throws Exception
   {
      ArrayMetaType type = new ArrayMetaType(2, SimpleMetaType.CHARACTER, true);
      char[][] value = {{'h', 'e'}, {'l', 'l', 'o'}};
      ArrayValueSupport avs = new ArrayValueSupport(type, value);
      assertEquals(value.length, avs.getLength());
      for(int m = 0; m < value.length; m ++)
      {
View Full Code Here

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

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

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

      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

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

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

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

      throws Exception
   {
      char[] array = {'H', 'e', 'l', 'l', 'o'};
      MetaType result = resolve(array.getClass());

      ArrayMetaType actual = assertInstanceOf(result, ArrayMetaType.class);
      ArrayMetaType expected = new ArrayMetaType(1, SimpleMetaType.CHARACTER_PRIMITIVE);
      testArray(expected, actual);
   }
View Full Code Here

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

            Character.valueOf('l'),
            Character.valueOf('l'),
            Character.valueOf('o')};
      MetaType result = resolve(array.getClass());
  
      ArrayMetaType actual = assertInstanceOf(result, ArrayMetaType.class);
      ArrayMetaType expected = new ArrayMetaType(1, SimpleMetaType.CHARACTER);
      testArray(expected, actual);
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.