Examples of TypeInfo


Examples of org.jboss.reflect.spi.TypeInfo

   // ClassAdapterFactory implementation ----------------------------

   public ClassAdapter getClassAdapter(Class clazz)
   {
      TypeInfo typeInfo = typeInfoFactory.getTypeInfo(clazz);
      return createClassAdapter(typeInfo);
   }
View Full Code Here

Examples of org.jboss.reflect.spi.TypeInfo

      return createClassAdapter(typeInfo);
   }
  
   public ClassAdapter getClassAdapter(String name, ClassLoader cl) throws ClassNotFoundException
   {
      TypeInfo typeInfo = typeInfoFactory.getTypeInfo(name, cl);
      return createClassAdapter(typeInfo);
   }
View Full Code Here

Examples of org.jboss.reflect.spi.TypeInfo

   {
      Collection result = (Collection) getCollectionInstance(info, cl, Collection.class);
      if (result == null)
         result = (Collection) getDefaultCollectionInstance();

      TypeInfo elementTypeInfo = getElementClassInfo(cl);

      for (int i = 0; i < collection.size(); ++i)
      {
         ValueMetaData vmd = (ValueMetaData) collection.get(i);
         result.add(vmd.getValue(elementTypeInfo, cl));
View Full Code Here

Examples of org.jboss.reflect.spi.TypeInfo

    * @return the class instance
    * @throws Throwable for any error
    */
   protected Object getCollectionInstance(TypeInfo info, ClassLoader cl, Class expected) throws Throwable
   {
      TypeInfo typeInfo = getClassInfo(cl);
     
      if (typeInfo != null && typeInfo instanceof ClassInfo == false)
         throw new IllegalArgumentException(typeInfo.getName() + " is not a class");
     
      if (typeInfo != null && ((ClassInfo) typeInfo).isInterface())
         throw new IllegalArgumentException(typeInfo.getName() + " is an interface");

      if (typeInfo == null)
      {
         // No type specified
         if (info == null)
            return null;
         // Not a class
         if (info instanceof ClassInfo == false)
            return null;
         // Not an interface
         if (((ClassInfo) info).isInterface())
            return null;
         // Type is too general
         if (Object.class.getName().equals(info.getName()))
            return null;
         // Try to use the passed type
         typeInfo = info;
      }
     
      BeanInfo beanInfo = configurator.getBeanInfo(typeInfo.getType());
      Joinpoint constructor = configurator.getConstructorJoinPoint(beanInfo);
      Object result = constructor.dispatch();
      if (expected.isAssignableFrom(result.getClass()) == false)
         throw new ClassCastException(result.getClass() + " is not a " + expected.getName());
      return result;
View Full Code Here

Examples of org.jboss.reflect.spi.TypeInfo

   public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable
   {
      Collection result = (Collection) super.getValue(info, cl);

      TypeInfo typeInfo = getClassInfo(cl);
     
      if (typeInfo != null && typeInfo instanceof ClassInfo == false)
         throw new IllegalArgumentException(typeInfo.getName() + " is not a class");

      if (typeInfo == null)
      {
         // No type specified
         if (info == null)
            return null;
         // Not a class
         if (info instanceof ClassInfo == false)
            return null;
         // Not an interface
         if (((ClassInfo) info).isInterface())
            return null;
         // Type is too general
         if (Object.class.getName().equals(info.getName()))
            return null;
         // Try to use the passed type
         typeInfo = info;
      }
     
      Object[] array = new Object[result.size()];
      if (typeInfo != null)
      {
         Class clazz = typeInfo.getType();
         if (clazz != null)
         {
            if (clazz.isArray() == false)
               throw new ClassCastException(clazz + " is not an array.");
            array = (Object[]) Array.newInstance(clazz.getComponentType(), result.size());
View Full Code Here

Examples of org.jboss.reflect.spi.TypeInfo

   {
      boolean trace = log.isTraceEnabled();
      if (trace)
         log.trace("getValue value=" + value + " type=" + type + " info=" + info);
     
      TypeInfo typeInfo = getClassInfo(cl);
      if (typeInfo == null)
         typeInfo = info;
      if (typeInfo == null)
         throw new IllegalArgumentException("Unable to determine type for value: " + value);
        
      Class clazz = typeInfo.getType();
      PropertyEditor editor = PropertyEditorManager.findEditor(clazz);
      if (editor != null)
      {
         editor.setAsText((String) value);
         return editor.getValue();
View Full Code Here

Examples of org.jboss.reflect.spi.TypeInfo

   {
      Map result = (Map) getMapInstance(info, cl, Map.class);
      if (result == null)
         result = (Map) getDefaultMapInstance();

      TypeInfo keyTypeInfo = getKeyClassInfo(cl);
      TypeInfo valueTypeInfo = getValueClassInfo(cl);

      if (map.size() > 0)
      {
         for (Iterator i = map.entrySet().iterator(); i.hasNext();)
         {
View Full Code Here

Examples of org.jboss.reflect.spi.TypeInfo

    * @return the class instance
    * @throws Throwable for any error
    */
   protected Object getMapInstance(TypeInfo info, ClassLoader cl, Class expected) throws Throwable
   {
      TypeInfo typeInfo = getClassInfo(cl);

      if (typeInfo != null && typeInfo instanceof ClassInfo == false)
         throw new IllegalArgumentException(typeInfo.getName() + " is not a class");

      if (typeInfo != null && ((ClassInfo) typeInfo).isInterface())
         throw new IllegalArgumentException(typeInfo.getName() + " is an interface");

      if (typeInfo == null)
      {
         // No type specified
         if (info == null)
            return null;
         // Not a class
         if (info instanceof ClassInfo == false)
            return null;
         // Not an interface
         if (((ClassInfo) info).isInterface())
            return null;
         // Type is too general
         if (Object.class.getName().equals(info.getName()))
            return null;
         // Try to use the passed type
         typeInfo = info;
      }

      BeanInfo beanInfo = configurator.getBeanInfo(typeInfo.getType());
      Joinpoint constructor = configurator.getConstructorJoinPoint(beanInfo);
      Object result = constructor.dispatch();
      if (expected.isAssignableFrom(result.getClass()) == false)
         throw new ClassCastException(result.getClass() + " is not a " + expected.getName());
      return result;
View Full Code Here

Examples of org.jboss.reflect.spi.TypeInfo

   }

   protected ClassInfo getClassInfo(Class clazz)
   {
      IntrospectionTypeInfoFactory factory = new IntrospectionTypeInfoFactory();
      TypeInfo info = factory.getTypeInfo(clazz);
      assertNotNull(info);
      assertTrue(info instanceof ClassInfo);
      ClassInfo cinfo = (ClassInfo) info;
      getLog().debug(cinfo);
      return cinfo;
View Full Code Here

Examples of org.jboss.reflect.spi.TypeInfo

   {
      TypeInfoFactory factory = new IntrospectionTypeInfoFactory();

      ClassInfo simpleInterface = (ClassInfo) factory.getTypeInfo(SimpleInterface.class);
     
      TypeInfo objectType = factory.getTypeInfo(Object.class);
     
      HashSet result = new HashSet();
      result.add(new FieldInfoImpl(null, "A_CONSTANT", objectType, ModifierInfo.PUBLIC_CONSTANT, simpleInterface));
      return result;
   }
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.