Package org.jboss.reflect.spi

Examples of org.jboss.reflect.spi.MethodInfo


               annotations = merged.toArray(new AnnotationValue[merged.size()]);
            }
           
            TypeInfo type = factory.getTypeInfo(getter.getGenericReturnType());
            ClassInfo declaringType = (ClassInfo) factory.getTypeInfo(getter.getDeclaringClass());
            MethodInfo getterInfo = new MethodInfoImpl(null, getter.getName(), type, new TypeInfo[0], null, null, getter.getModifiers(), declaringType);
            MethodInfo setterInfo = null;
            if (setter != null)
            {
               declaringType = (ClassInfo) factory.getTypeInfo(setter.getDeclaringClass());
               AnnotationValue[][] paramAnnotations = new AnnotationValue[1][];
               setterAnnotations = getExpectedAnnotations(setter.getParameterAnnotations()[0]);
               paramAnnotations[0] = setterAnnotations.toArray(new AnnotationValue[setterAnnotations.size()]);
               setterInfo = new MethodInfoImpl(null, setter.getName(), PrimitiveInfo.VOID, new TypeInfo[] { type }, paramAnnotations, null, setter.getModifiers(), declaringType);
            }
            properties.put(lowerName, new DefaultPropertyInfo(lowerName, name, type, getterInfo, setterInfo, annotations));
         }
      }
      if (setters.isEmpty() == false)
      {
         for (Iterator<Map.Entry<String, List<Method>>> i = setters.entrySet().iterator(); i.hasNext();)
         {
            Map.Entry<String, List<Method>> entry = i.next();
            String name = entry.getKey();
            List<Method> setterList = entry.getValue();
            // TODO JBMICROCONT-125 Maybe should just create duplicate propertyInfo and let the configurator guess?
            if (setterList.size() == 1)
            {
               Method setter = setterList.get(0);
               Type pinfo = setter.getGenericParameterTypes()[0];
               TypeInfo type = factory.getTypeInfo(pinfo);
               String lowerName = getLowerPropertyName(name);
               Set<AnnotationValue> setterAnnotations = getExpectedAnnotations(setter.getAnnotations());
               AnnotationValue[] annotations = setterAnnotations.toArray(new AnnotationValue[setterAnnotations.size()]);
               ClassInfo declaringType = (ClassInfo) factory.getTypeInfo(setter.getDeclaringClass());
               AnnotationValue[][] paramAnnotations = new AnnotationValue[1][];
               setterAnnotations = getExpectedAnnotations(setter.getParameterAnnotations()[0]);
               paramAnnotations[0] = setterAnnotations.toArray(new AnnotationValue[setterAnnotations.size()]);
               MethodInfo setterInfo = new MethodInfoImpl(null, setter.getName(), PrimitiveInfo.VOID, new TypeInfo[] { type }, paramAnnotations, null, setter.getModifiers(), declaringType);
               properties.put(lowerName, new DefaultPropertyInfo(lowerName, name, type, null, setterInfo, annotations));
            }
         }
      }
      if (mode != BeanAccessMode.STANDARD)
View Full Code Here


         {
            String name = method.getName();
            ClassInfo declaringType = (ClassInfo) factory.getTypeInfo(method.getDeclaringClass());
            Set<AnnotationValue> getterAnnotations = getExpectedAnnotations(method.getAnnotations());
            AnnotationValue[] annotations = getterAnnotations.toArray(new AnnotationValue[getterAnnotations.size()]);
            MethodInfo getter = new MethodInfoImpl(null, name, returnType, new TypeInfo[0], new AnnotationValue[0][], null, method.getModifiers(), declaringType);
            properties.add(new DefaultPropertyInfo(name, name, returnType, getter, null, annotations));
         }
      }
      return properties;
   }
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

      if(metaData != null)
      {
         annotation = metaData.getAnnotation(annotationType);
         if(annotation == null && info instanceof MethodInfo)
         {
            MethodInfo mi = (MethodInfo) info;
            Signature mis = Signature.getSignature(mi);
            MetaData imetaData = metaData.getComponentMetaData(mis);
            if (imetaData != null)
               annotation = imetaData.getAnnotation(annotationType);
         }
View Full Code Here

   protected void validateMethodValues(String name, String[] signature, Object[] paramaters) throws Throwable
   {
      BeanValidatorBridge bridge = KernelControllerContextAction.getBeanValidatorBridge(this);
      if (bridge != null)
      {
         MethodInfo methodInfo = Config.findMethodInfo(getInfo().getClassInfo(), name, signature);
         bridge.validateMethodValues(this, getTarget(), methodInfo, paramaters);
      }
   }
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 = Config.findMethodInfo(getClassInfo(context), method, parameterTypes);
      return applyCollectionOrMapCheck(methodInfo.getParameterTypes()[parameter.getIndex()]);
   }
View Full Code Here

   }

   private static Set<Annotation> populateQualifiersFromAnnotationsForProperty(KernelControllerContext context, MetaData metaData, PropertyMetaData property)
   {
      PropertyInfo info = context.getBeanInfo().getProperty(property.getName());
      MethodInfo setter = info.getSetter();
      if (setter != null)
      {
         MetaData methodMetaData = metaData.getComponentMetaData(new DeclaredMethodSignature(setter));
         MetaData paramMetaData = metaData.getComponentMetaData(new MethodParametersSignature(setter, 0));
         return populateQualifiersFromAnnotationsMetaData(methodMetaData, paramMetaData);
      }
      FieldInfo field = info.getFieldInfo();
      if (field != null)
      {
         MetaData fieldMetaData = metaData.getComponentMetaData(new FieldSignature(field));
         return populateQualifiersFromAnnotationsMetaData((Set<Annotation>)null, fieldMetaData);
      }
      MethodInfo getter = info.getGetter();
      if (getter != null)
      {
         MetaData methodMetaData = metaData.getComponentMetaData(new DeclaredMethodSignature(getter));
         return populateQualifiersFromAnnotationsMetaData((Set<Annotation>)null, methodMetaData);
      }
View Full Code Here

   private static Set<Annotation> populateQualifiersFromAnnotationsForMethod(KernelControllerContext context, MetaData metaData, ParameterMetaData pmd, LifecycleMetaData lmd) throws Exception
   {
      String[] paramTypes = new String[lmd.getParameters().size()];
      for (int i = 0 ; i < paramTypes.length ; i++)
         paramTypes[i] = lmd.getParameters().get(i).getType();
      MethodInfo method = Config.findMethodInfo(context.getBeanInfo().getClassInfo(), lmd.getMethodName(), paramTypes, false);
     
      MetaData methodMetaData = metaData.getComponentMetaData(new DeclaredMethodSignature(method));
      MetaData paramMetaData = metaData.getComponentMetaData(new MethodParametersSignature(method, pmd.getIndex()));
     
      return populateQualifiersFromAnnotationsMetaData(methodMetaData, paramMetaData);
View Full Code Here

      if (propertyAnnotations == null || propertyAnnotations.size() == 0)
         return;

      PropertyInfo propertyInfo = beanInfo.getProperty(propertyMetaData.getName());
      // method annotations
      MethodInfo methodInfo = propertyInfo.getGetter();
      if (methodInfo != null)
         updateAnnotations(repository, classloader, mutable, context, methodInfo, propertyAnnotations, add);
      methodInfo = propertyInfo.getSetter();
      if (methodInfo != null)
         updateAnnotations(repository, classloader, mutable, context, methodInfo, propertyAnnotations, add);
View Full Code Here

      if (install.getBean() != null && install.getBean().equals(context.getName()) == false)
         return;
     
      List<ParameterMetaData> parameters = install.getParameters();
      String[] paramTypes = parameters == null ? NO_PARAM_TYPES : new String[parameters.size()];
      MethodInfo method = Config.findMethodInfo(context.getBeanInfo().getClassInfo(), install.getMethodName(), paramTypes, false);
     
      Set<AnnotationMetaData> methodAnnotations = install.getAnnotations();
     
      if (methodAnnotations != null && methodAnnotations.size() > 0)
      {
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.