Package org.jboss.reflect.spi

Examples of org.jboss.reflect.spi.MethodInfo


   }

   private void injectToMethod(Class<?> clazz, String method, Object value, Class<?> signature, boolean isPublic) throws Throwable
   {
      ClassInfo classInfo = configurator.getClassInfo(clazz);
      MethodInfo mi = Config.findMethodInfo(classInfo, method, new String[]{signature.getName()}, true, isPublic);
      if (isPublic == false)
      {
         // TODO - move this into Reflection?
         if (mi instanceof ReflectMethodInfoImpl)
         {
            ReflectMethodInfoImpl rmi = (ReflectMethodInfoImpl)mi;
            Method  m = rmi.getMethod();
            m.setAccessible(true);
         }
         else
            throw new IllegalArgumentException("Cannot set accessible on method info: " + mi);
      }
      mi.invoke(null, new Object[]{value});
   }
View Full Code Here


   {
      ParameterMetaData parameter = (ParameterMetaData) previous;
      KernelControllerContext context = visitor.getControllerContext();
      String method = (methodName != null ? methodName : type);
      String[] parameterTypes = Configurator.getParameterTypes(false, parameters);
      MethodInfo methodInfo = Configurator.findMethodInfo(getClassInfo(context), method, parameterTypes);
      return applyCollectionOrMapCheck(methodInfo.getParameterTypes()[parameter.getIndex()]);
   }
View Full Code Here

      // Push into the cache early to avoid recursion
      typeCache.put(typeInfo, typeBinding);

      // Determine any factory method
      MethodInfo factory = null;
      if (factoryMethod != null && factoryMethod.length() > 0)
         factory = Config.findMethodInfo(factoryClassInfo, factoryMethod, null, true, true);

      // Create the handler
      BeanInfo beanInfo = JBossXBBuilder.configuration.getBeanInfo(typeInfo);
View Full Code Here

            classInfo = configurator.getClassInfo(factoryClassName, cl);
         }
         // should be parameter
         ParameterMetaData parameter = (ParameterMetaData) previous;
         String[] parameterTypes = Configurator.getParameterTypes(false, parameters);
         MethodInfo methodInfo = Configurator.findMethodInfo(classInfo, factoryMethod, parameterTypes, factoryClassName != null, true);
         return applyCollectionOrMapCheck(methodInfo.getParameterTypes()[parameter.getIndex()]);
      }
      else
      {
         KernelControllerContext context = visitor.getControllerContext();
         BeanInfo beanInfo = context.getBeanInfo();
View Full Code Here

   public MethodInfo getDeclaredMethod(String name, TypeInfo[] parameters)
   {
      SignatureKey key = new SignatureKey(name, parameters);
      synchronized (methods)
      {
         MethodInfo method = methods.get(key);
         if (method != null)
            return method;
      }
      if (methodArray != null)
         return null;
View Full Code Here

      {
         for (Iterator<Map.Entry<String, MethodInfo>> i = getters.entrySet().iterator(); i.hasNext();)
         {
            Map.Entry<String, MethodInfo> entry = i.next();
            String name = entry.getKey();
            MethodInfo getter = entry.getValue();
            MethodInfo setter = null;
            List<MethodInfo> setterList = setters.remove(name);
            if (setterList != null && setterList.size() != 0)
            {
               for (int j = 0; j < setterList.size(); ++j)
               {
                  MethodInfo thisSetter = setterList.get(j);
                  TypeInfo pinfo = thisSetter.getParameterTypes()[0];
                  if (getter.getReturnType().equals(pinfo) == true)
                  {
                     setter = thisSetter;
                     break;
                  }
View Full Code Here

         TypeInfo[] paramTypes = new TypeInfo[paramClasses.length];
         AnnotationValue[][] paramAnnotations = new AnnotationValue[paramClasses.length][0];
         int i = 0;
         for (Class<?> c : paramClasses)
            paramTypes[i++] = factory.getTypeInfo(c);
         MethodInfo m = new MethodInfoImpl(null, method.getName(), returnType, paramTypes, paramAnnotations, null, method.getModifiers(), classInfo);
         expected.add(m);
      }
     
      MethodInfo[] result = classInfo.getDeclaredMethods();
      if (expected.isEmpty())
View Full Code Here

     
      Type[] paramClasses = method.getGenericParameterTypes();
      TypeInfo[] paramTypes = new TypeInfo[paramClasses.length];
      for (int i = 0; i < paramClasses.length; ++i)
         paramTypes[i] = factory.getTypeInfo(paramClasses[i]);
      MethodInfo methodInfo = classInfo.getDeclaredMethod(method.getName(), paramTypes);
      assertNotNull(method.getName(), methodInfo);
      TypeInfo returnType = factory.getTypeInfo(method.getGenericReturnType());
      TypeInfo[] actualParamTypes = methodInfo.getParameterTypes();
      for (int i = 0; i < paramTypes.length; ++i)
         assertTypeEquals(method.getName() + " param" + i, paramTypes[i], actualParamTypes[i]);
      Class<?>[] exceptionClasses = method.getExceptionTypes();
      TypeInfo[] expectedExceptionTypes = new TypeInfo[exceptionClasses.length];
      for (int i = 0; i < exceptionClasses.length; ++i)
         expectedExceptionTypes[i] = factory.getTypeInfo(exceptionClasses[i]);
      TypeInfo[] actualExceptionTypes = methodInfo.getExceptionTypes();
      for (int i = 0; i < exceptionClasses.length; ++i)
         assertTypeEquals(method.getName() + " exception" + i, expectedExceptionTypes[i], actualExceptionTypes[i]);
      assertTypeEquals(method.getName() + " returnType", returnType, methodInfo.getReturnType());
      assertEquals(classInfo, methodInfo.getDeclaringClass());
      assertEquals(method.getModifiers(), methodInfo.getModifiers());
      assertMethodAnnotations(method, methodInfo);
      assertParameterAnnotations(method, methodInfo);
   }
View Full Code Here

      expectClone = new HashSet<MethodInfo>(expected);
      actualClone = new ArrayList<MethodInfo>(Arrays.asList(actually));
      for (Iterator<MethodInfo> i = expectClone.iterator(); i.hasNext();)
      {
         MethodInfo expect = i.next();
         int j = actualClone.indexOf(expect);
         MethodInfo actual = actualClone.get(j);
         compareMethod(expect, actual);
      }
   }
View Full Code Here

         AnnotationValue[][] paramAnnotations = new AnnotationValue[paramClasses.length][0];
         int i = 0;
         for (Class<?> c : paramClasses)
            paramTypes[i++] = factory.getTypeInfo(c);
         ClassInfo classInfo = (ClassInfo) factory.getTypeInfo(method.getDeclaringClass());
         MethodInfo m = new MethodInfoImpl(null, method.getName(), returnType, paramTypes, paramAnnotations, null, method.getModifiers(), classInfo);
         expected.add(m);
      }
     
      Set<MethodInfo> actual = beanInfo.getMethods();
      if (expected.isEmpty())
View Full Code Here

TOP

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

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.