Examples of TypeInfo


Examples of org.jboss.reflect.spi.TypeInfo

      ClassInfo classInfo = configuration.getClassInfo(value.getClass());
      if (classInfo.isArray())
      {
         // See if this is a primitive array
         ArrayInfo arrayInfo = ArrayInfo.class.cast(classInfo);
         TypeInfo compInfo = arrayInfo.getComponentType();
         while(compInfo instanceof ArrayInfo)
         {
            arrayInfo = ArrayInfo.class.cast(compInfo);
            compInfo = arrayInfo.getComponentType();
         }
         // Translate
         if (compInfo.isPrimitive())
            oldArray = convertPrimativeArray(classInfo, value);
         else
            oldArray = (Object[]) value;
      }
      else
View Full Code Here

Examples of org.jboss.reflect.spi.TypeInfo

   }
  
   @Override
   public MetaValue create(Object value, Type type)
   {
      TypeInfo typeInfo = configuration.getTypeInfo(type);
      return internalCreate(value, typeInfo, null);
   }
View Full Code Here

Examples of org.jboss.reflect.spi.TypeInfo

   }

   @Override
   public Object unwrap(MetaValue metaValue, Type type)
   {
      TypeInfo typeInfo = configuration.getTypeInfo(type);
      return internalUnwrap(metaValue, typeInfo);
   }
View Full Code Here

Examples of org.jboss.reflect.spi.TypeInfo

    * @param array parent array
    * @return unwrapped value
    */
   protected Object unwrapMetaValue(MetaValue element, TypeInfo type, Object array)
   {
      TypeInfo elementType;
      if (type instanceof ClassInfo)
         elementType = ((ClassInfo)type).getComponentType();
      else
         elementType = getTypeInfo(element.getMetaType(), array);
      return unwrap(element, elementType);
View Full Code Here

Examples of org.jboss.reflect.spi.TypeInfo

    * @param element current array element
    * @return unwrapped array element
    */
   protected Object unwrapArray(Object array, Object element)
   {
      TypeInfo elementType = configuration.getTypeInfo(array.getClass().getComponentType());
      int subSize = Array.getLength(element);
      Object newElement = newArrayInstance(elementType, subSize);
      for(int i = 0; i < subSize; i++)
      {
         Object subElement = Array.get(element, i);
View Full Code Here

Examples of org.jboss.reflect.spi.TypeInfo

            collectionInfo = configuration.getBeanInfo(metaType.getTypeName(), Thread.currentThread().getContextClassLoader());
         }
         ClassInfo classInfo = collectionInfo.getClassInfo();
         Collection collection = (Collection)createNewInstance(collectionInfo);

         TypeInfo componentType = classInfo.getComponentType();
         boolean isObjectTypeInfo = OBJECT_TYPE_INFO.equals(componentType);

         for (MetaValue metaValue : collectionValue)
         {
            TypeInfo iterTypeInfo = isObjectTypeInfo ? getTypeInfo(metaValue.getMetaType(), null) : componentType;
            collection.add(unwrap(metaValue, iterTypeInfo));
         }
         return collection;
      }
      catch (Throwable t)
View Full Code Here

Examples of org.jboss.reflect.spi.TypeInfo

      {
         ParameterizedClassInfo parameterizedType = (ParameterizedClassInfo)type;
         ClassInfo rawType = parameterizedType.getRawType();
         if (Map.class.isAssignableFrom(rawType.getType()))
         {
            TypeInfo keyType = parameterizedType.getActualTypeArguments()[0];
            TypeInfo valueType = parameterizedType.getActualTypeArguments()[1];
            return createMap(tableValue, keyType, valueType);
         }
      }
      throw new UnsupportedOperationException("Insufficient information to unwrap table: " + tableValue + ", " + type);
   }
View Full Code Here

Examples of org.jboss.reflect.spi.TypeInfo

            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--;
            }
            return typeInfo;
         }
         return tif.getTypeInfo(metaType.getTypeName(), cl);
View Full Code Here

Examples of org.jboss.reflect.spi.TypeInfo

      MetaValue[] elements = new MetaValue[collection.size()];
      int i = 0;
      for(Object ce : collection)
      {
         // recalculate element info, since usually more deterministic
         TypeInfo typeInfo = configuration.getTypeInfo(ce.getClass());
         MetaType metaType = metaTypeFactory.resolve(typeInfo);
         elements[i++] = internalCreate(ce, typeInfo, metaType);            
      }
      CollectionValue result = new CollectionValueSupport(type, elements);
      mapping.put(value, result);
View Full Code Here

Examples of org.jboss.reflect.spi.TypeInfo

      Object[] oa;
      if( type instanceof ArrayInfo )
      {
         // Get the Object form of the element
         ArrayInfo arrayInfo = ArrayInfo.class.cast(type);
         TypeInfo etype = arrayInfo.getComponentType();
         int size = Array.getLength(value);
         oa = new Object[size];
         for(int n = 0; n < size; n ++)
         {
            Object nvalue = Array.get(value, n);
            // Recursively convert nested array elements
            if (etype.isArray())
            {
               oa[n] = convertPrimativeArray(etype, nvalue);
            }
            oa[n] = nvalue;
         }
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.