Package org.jboss.metadata.spi.signature

Examples of org.jboss.metadata.spi.signature.MethodParametersSignature


         {
            try
            {
               Method method = clazz.getMethod(signature.getName(), signature.getParametersTypes(clazz));
               Annotation[][] paramAnnotations = method.getParameterAnnotations();
               MethodParametersSignature sig = (MethodParametersSignature) signature;
               return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]);
            }
            catch (NoSuchMethodException e)
            {
               return null;
            }
         }
         else if (signature instanceof FieldSignature)
         {
            Field field = ReflectionUtils.findField(clazz, signature.getName());
            return field != null ? new AnnotatedElementMetaDataLoader(field) : null;
         }
      }

      if (annotated instanceof Method)
      {
         if (signature instanceof MethodParametersSignature)
         {
            Method method = (Method)annotated;
            Annotation[][] paramAnnotations = method.getParameterAnnotations();
            MethodParametersSignature sig = (MethodParametersSignature) signature;
            return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]);
         }
      }

      if (annotated instanceof Constructor)
      {
         if (signature instanceof MethodParametersSignature)
         {
            Constructor<?> constructor = Constructor.class.cast(annotated);
            Annotation[][] paramAnnotations = constructor.getParameterAnnotations();
            MethodParametersSignature sig = (MethodParametersSignature) signature;
            return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]);
         }
      }

      return null;
   }
View Full Code Here


            }
            return new AnnotatedElementMetaDataLoader(method);
         }
         else if (signature instanceof MethodParametersSignature)
         {
            MethodParametersSignature methodParametersSignature = (MethodParametersSignature) signature;
            Method method = methodParametersSignature.getMethod();
            if (method == null)
               method = SecurityActions.findMethod(clazz, signature.getName(), signature.getParametersTypes(clazz));
            if (method == null)
            {
               if (log.isTraceEnabled())
                  log.trace("Method with signature " + signature + " does not exist on class " + clazz.getName());
               return null;
            }
            Annotation[][] paramAnnotations = method.getParameterAnnotations();
            return new SimpleMetaDataLoader(paramAnnotations[methodParametersSignature.getParam()]);
         }
         else if (signature instanceof ConstructorParametersSignature)
         {
            ConstructorParametersSignature constructorParametersSignature = (ConstructorParametersSignature) signature;
            Constructor<?> constructor = constructorParametersSignature.getConstructor();
            if (constructor == null)
               constructor = SecurityActions.findConstructor(clazz, signature.getParametersTypes(clazz));
            if (constructor == null)
            {
               if (log.isTraceEnabled())
                  log.trace("Constructor with signature " + signature + " does not exist on class " + clazz.getName());
               return null;
            }
            Annotation[][] paramAnnotations = constructor.getParameterAnnotations();
            return new SimpleMetaDataLoader(paramAnnotations[constructorParametersSignature.getParam()]);
         }
         else if (signature instanceof FieldSignature)
         {
            FieldSignature fieldSignature = (FieldSignature) signature;
            Field field = fieldSignature.getField();
            if (field == null)
               field = SecurityActions.findField(clazz, signature.getName());
            if (field == null)
            {
               if (log.isTraceEnabled())
                  log.trace("Field " + signature.getName() + " does not exist on class " + clazz.getName());
               return null;
            }
            return new AnnotatedElementMetaDataLoader(field);
         }
      }

      if (annotated instanceof Method)
      {
         if (signature instanceof MethodParametersSignature)
         {
            Method method = (Method)annotated;
            Annotation[][] paramAnnotations = method.getParameterAnnotations();
            MethodParametersSignature sig = (MethodParametersSignature) signature;
            return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]);
         }
      }

      if (annotated instanceof Constructor)
      {
         if (signature instanceof ConstructorParametersSignature)
         {
            Constructor<?> constructor = Constructor.class.cast(annotated);
            Annotation[][] paramAnnotations = constructor.getParameterAnnotations();
            ConstructorParametersSignature sig = (ConstructorParametersSignature) signature;
            return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]);
         }
      }

      return null;
   }
View Full Code Here

      super(annotation, adapters);
   }

   protected Signature createParametersSignature(String name, String[] parameters, int index)
   {
      return new MethodParametersSignature(name, parameters, index);
   }
View Full Code Here

      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)
      {
View Full Code Here

      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

   private void updateAnnotations(MutableMetaDataRepository repository, ClassLoader classloader, ComponentMutableMetaData component, KernelControllerContext context, MethodInfo methodInfo, int parameterIndex, Set<AnnotationMetaData> annotations, boolean add)
   {
      if (annotations == null || annotations.isEmpty())
         return;

      Signature signature = new MethodParametersSignature(methodInfo, parameterIndex);
      ScopeKey scope = new ScopeKey(CommonLevels.JOINPOINT_OVERRIDE, methodInfo.getName() + parameterIndex);
      updateAnnotations(repository, classloader, component, context, signature, scope, annotations, add);
   }
View Full Code Here

         {
         }
      }
      else if (signature instanceof MethodParametersSignature)
      {
         MethodParametersSignature mps = (MethodParametersSignature)signature;
         try
         {
            Method method = clazz.getMethod(signature.getName(), signature.getParametersTypes(clazz));
            annotations = method.getParameterAnnotations()[mps.getParam()];
         }
         catch (NoSuchMethodException ignored)
         {
         }
      }
View Full Code Here

         {
            try
            {
               Method method = clazz.getMethod(signature.getName(), signature.getParametersTypes(clazz));
               Annotation[][] paramAnnotations = method.getParameterAnnotations();
               MethodParametersSignature sig = (MethodParametersSignature) signature;
               return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]);
            }
            catch (NoSuchMethodException e)
            {
               return null;
            }
         }
         else if (signature instanceof FieldSignature)
         {
            try
            {
               Field field = clazz.getField(signature.getName());
               return new AnnotatedElementMetaDataLoader(field);
            }
            catch (NoSuchFieldException e)
            {
               return null;
            }
         }
      }

      if (annotated instanceof Method)
      {
         if (signature instanceof MethodParametersSignature)
         {
            Method method = (Method)annotated;
            Annotation[][] paramAnnotations = method.getParameterAnnotations();
            MethodParametersSignature sig = (MethodParametersSignature) signature;
            return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]);
         }
      }

      if (annotated instanceof Constructor)
      {
         if (signature instanceof MethodParametersSignature)
         {
            Constructor<?> constructor = Constructor.class.cast(annotated);
            Annotation[][] paramAnnotations = constructor.getParameterAnnotations();
            MethodParametersSignature sig = (MethodParametersSignature) signature;
            return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]);
         }
      }

      return null;
   }
View Full Code Here

         {
            try
            {
               Method method = clazz.getMethod(signature.getName(), signature.getParametersTypes(clazz));
               Annotation[][] paramAnnotations = method.getParameterAnnotations();
               MethodParametersSignature sig = (MethodParametersSignature) signature;
               return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]);
            }
            catch (NoSuchMethodException e)
            {
               return null;
            }
         }
         else if (signature instanceof FieldSignature)
         {
            try
            {
               Field field = clazz.getField(signature.getName());
               return new AnnotatedElementMetaDataLoader(field);
            }
            catch (NoSuchFieldException e)
            {
               return null;
            }
         }
      }

      if (annotated instanceof Method)
      {
         if (signature instanceof MethodParametersSignature)
         {
            Method method = (Method)annotated;
            Annotation[][] paramAnnotations = method.getParameterAnnotations();
            MethodParametersSignature sig = (MethodParametersSignature) signature;
            return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]);
         }
      }

      if (annotated instanceof Constructor)
      {
         if (signature instanceof MethodParametersSignature)
         {
            Constructor constructor = (Constructor)annotated;
            Annotation[][] paramAnnotations = constructor.getParameterAnnotations();
            MethodParametersSignature sig = (MethodParametersSignature) signature;
            return new SimpleMetaDataLoader(paramAnnotations[sig.getParam()]);
         }
      }

      return null;
   }
View Full Code Here

      List<ParameterMetaData> pmds = new ArrayList<ParameterMetaData>();
      for(int i=0; i < parameters.length; i++)
      {
         ParameterInfo pi = parameters[i];
         Signature pis = new MethodParametersSignature(
               pi.getName(),
               Configurator.getParameterTypes(log.isTraceEnabled(), typeInfos),
               i
         );
         MetaData mdr = retrieval.getComponentMetaData(pis);
View Full Code Here

TOP

Related Classes of org.jboss.metadata.spi.signature.MethodParametersSignature

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.