Package org.jboss.reflect.spi

Examples of org.jboss.reflect.spi.TypeInfoFactory


   }

   public void testArrayType()
   {
      String[] array = {"hello", "world"};
      TypeInfoFactory factory = getTypeInfoFactory();
      ArrayInfo info = (ArrayInfo) factory.getTypeInfo(array.getClass());

      assertEquals(info.getName(), "[Ljava.lang.String;", info.getName());
      TypeInfo info0 = info.getComponentType();
      assertEquals(info0.getName(), "java.lang.String", info0.getName());
   }
View Full Code Here


      assertEquals(info0.getName(), "java.lang.String", info0.getName());
   }
   public void test2DArrayType()
   {
      String[][] array = {{"hello"}, {"world"}};
      TypeInfoFactory factory = getTypeInfoFactory();
      ArrayInfo info = (ArrayInfo) factory.getTypeInfo(array.getClass());
     
      assertEquals(info.getName(), "[[Ljava.lang.String;", info.getName());
      ArrayInfo info0 = (ArrayInfo) info.getComponentType();
      assertEquals(info0.getName(), "[Ljava.lang.String;", info0.getName());
      TypeInfo info1 = info0.getComponentType();
View Full Code Here

      testArray(array);
   }
  
   private void testArray(Object array) throws Throwable
   {
      TypeInfoFactory factory = getTypeInfoFactory();
      Class<?> arrayClass = array.getClass();
      Class<?> componentClass = arrayClass.getComponentType();
      TypeInfo componentType = factory.getTypeInfo(componentClass);
      ArrayInfoImpl expected = new ArrayInfoImpl(componentType);
      TypeInfo info = testBasics(array.getClass(), expected);
     
      assertTrue(info.isArray());
      assertFalse(info.isEnum());
View Full Code Here

      checkConstructors(getSimpleBeanConstructors(), cinfo.getDeclaredConstructors());
   }

   protected ClassInfo getClassInfo(Class<?> clazz)
   {
      TypeInfoFactory factory = getTypeInfoFactory();
      TypeInfo info = factory.getTypeInfo(clazz);
      assertNotNull(info);
      assertTrue(info instanceof ClassInfo);
      ClassInfo cinfo = (ClassInfo) info;
      getLog().debug(cinfo);
      return cinfo;
View Full Code Here

      assertEquals("Annotations", expect.getAnnotations(), actual.getAnnotations());
   }
  
   protected Set<FieldInfo> getSimpleInterfaceFields()
   {
      TypeInfoFactory factory = getTypeInfoFactory();

      ClassInfo simpleInterface = (ClassInfo) factory.getTypeInfo(SimpleInterface.class);
     
      TypeInfo objectType = factory.getTypeInfo(Object.class);
     
      HashSet<FieldInfo> result = new HashSet<FieldInfo>();
      result.add(new FieldInfoImpl(null, "A_CONSTANT", objectType, ModifierInfo.PUBLIC_CONSTANT, simpleInterface));
      return result;
   }
View Full Code Here

      return result;
   }
  
   protected Set<MethodInfo> getSimpleInterfaceMethods()
   {
      TypeInfoFactory factory = getTypeInfoFactory();

      ClassInfo simpleInterface = (ClassInfo) factory.getTypeInfo(SimpleInterface.class);
     
      TypeInfo boolType = PrimitiveInfo.BOOLEAN;
      ParameterInfo boolParam = new ParameterInfoImpl(null, "arg0", boolType);
      ParameterInfo[] boolParameters = new ParameterInfo[] { boolParam };

      TypeInfo booleanType = factory.getTypeInfo(Boolean.class);

      TypeInfo intType = PrimitiveInfo.INT;
      ParameterInfo intParam = new ParameterInfoImpl(null, "arg0", intType);
      ParameterInfo[] intParameters = new ParameterInfo[] { intParam };

      TypeInfo objectType = factory.getTypeInfo(Object.class);
      ParameterInfo objectParam = new ParameterInfoImpl(null, "arg0", objectType);
      ParameterInfo[] objectParameters = new ParameterInfo[] { objectParam };

      TypeInfo stringType = factory.getTypeInfo(String.class);
      ParameterInfo stringParam = new ParameterInfoImpl(null, "arg0", stringType);
      ParameterInfo[] stringParameters = new ParameterInfo[] { stringParam };

      TypeInfo urlType = factory.getTypeInfo(URL.class);
      ParameterInfo urlParam = new ParameterInfoImpl(null, "arg1", urlType);
      ParameterInfo[] twoParameters = new ParameterInfo[] { stringParam, urlParam };

      TypeInfo voidType = PrimitiveInfo.VOID;
     
View Full Code Here

      return result;
   }
  
   protected MethodInfo getAnotherInterfaceSomeMethod()
   {
      TypeInfoFactory factory = getTypeInfoFactory();

      TypeInfo voidType = PrimitiveInfo.VOID;

      ClassInfo anotherInterface = (ClassInfo) factory.getTypeInfo(AnotherInterface.class);

      return new MethodInfoImpl(null, "someMethod", voidType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, anotherInterface);
   }
View Full Code Here

      return new MethodInfoImpl(null, "someMethod", voidType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC_ABSTRACT, anotherInterface);
   }
  
   protected Set<FieldInfo> getSimpleBeanFields()
   {
      TypeInfoFactory factory = getTypeInfoFactory();

      TypeInfo longType = PrimitiveInfo.LONG;
     
      ClassInfo simpleBean = (ClassInfo) factory.getTypeInfo(SimpleBean.class);
     
      TypeInfo objectType = factory.getTypeInfo(Object.class);
     
      HashSet<FieldInfo> result = new HashSet<FieldInfo>();
      result.add(new FieldInfoImpl(null, "PUBLIC_CONSTANT", objectType, ModifierInfo.PUBLIC_CONSTANT, simpleBean));
      result.add(new FieldInfoImpl(null, "PACKAGE_PRIVATE_CONSTANT", objectType, ModifierInfo.PACKAGE_CONSTANT, simpleBean));
      result.add(new FieldInfoImpl(null, "PROTECTED_CONSTANT", objectType, ModifierInfo.PROTECTED_CONSTANT, simpleBean));
View Full Code Here

      return result;
   }
  
   protected Set<MethodInfo> getSimpleBeanMethods()
   {
      TypeInfoFactory factory = getTypeInfoFactory();

      ClassInfo simpleBean = (ClassInfo) factory.getTypeInfo(SimpleBean.class);
     
      TypeInfo boolType = PrimitiveInfo.BOOLEAN;
      ParameterInfo boolParam = new ParameterInfoImpl(null, "arg0", boolType);
      ParameterInfo[] boolParameters = new ParameterInfo[] { boolParam };

      TypeInfo booleanType = factory.getTypeInfo(Boolean.class);

      TypeInfo intType = PrimitiveInfo.INT;
      ParameterInfo intParam = new ParameterInfoImpl(null, "arg0", intType);
      ParameterInfo[] intParameters = new ParameterInfo[] { intParam };

      TypeInfo objectType = factory.getTypeInfo(Object.class);
      ParameterInfo objectParam = new ParameterInfoImpl(null, "arg0", objectType);
      ParameterInfo[] objectParameters = new ParameterInfo[] { objectParam };

      TypeInfo stringType = factory.getTypeInfo(String.class);
      ParameterInfo stringParam = new ParameterInfoImpl(null, "arg0", stringType);
      ParameterInfo[] stringParameters = new ParameterInfo[] { stringParam };

      TypeInfo urlType = factory.getTypeInfo(URL.class);
      ParameterInfo urlParam = new ParameterInfoImpl(null, "arg1", urlType);
      ParameterInfo[] twoParameters = new ParameterInfo[] { stringParam, urlParam };

      TypeInfo voidType = PrimitiveInfo.VOID;
     
View Full Code Here

      return result;
   }
  
   protected MethodInfo getAnotherBeanSomeMethod()
   {
      TypeInfoFactory factory = getTypeInfoFactory();

      TypeInfo voidType = PrimitiveInfo.VOID;

      ClassInfo anotherBean = (ClassInfo) factory.getTypeInfo(AnotherBean.class);

      return new MethodInfoImpl(null, "someMethod", voidType, MethodInfo.NO_PARAMS, MethodInfo.NO_EXCEPTIONS, ModifierInfo.PUBLIC, anotherBean);
   }
View Full Code Here

TOP

Related Classes of org.jboss.reflect.spi.TypeInfoFactory

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.