Package org.jboss.metadata.spi.signature

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


   {
      if (method == null)
         return;
     
      visitedMethods.add(method);
      Signature sis = new DeclaredMethodSignature(method);
      MetaData cmdr = retrieval.getComponentMetaData(sis);
      if (cmdr != null)
      {
         Annotation[] canns = cmdr.getAnnotations();
         for (int i = 0 ; i < canns.length ; i++)
View Full Code Here


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

      Signature signature = new ConstructorSignature(constructorInfo);
      ScopeKey scope = new ScopeKey(CommonLevels.JOINPOINT_OVERRIDE, "<NEW>");
      updateAnnotations(repository, classloader, component, context, signature, scope, annotations, add);
   }
View Full Code Here

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

      Signature signature = new ConstructorParametersSignature(constructorInfo, parameterIndex);
      ScopeKey scope = new ScopeKey(CommonLevels.JOINPOINT_OVERRIDE, "<NEW>" + parameterIndex);
      updateAnnotations(repository, classloader, component, context, signature, scope, annotations, add);
   }
View Full Code Here

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

      Signature signature = new MethodSignature(methodInfo);
      ScopeKey scope = new ScopeKey(CommonLevels.JOINPOINT_OVERRIDE, methodInfo.getName());
      updateAnnotations(repository, classloader, component, context, signature, scope, annotations, add);
   }
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

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

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

      Set<ConstructorInfo> constructors = info.getConstructors();
      if (constructors != null && constructors.isEmpty() == false)
      {
         for(ConstructorInfo ci : constructors)
         {
            Signature cis = new ConstructorSignature(ci);
            MetaData cmdr = retrieval.getComponentMetaData(cis);
            if (cmdr != null)
            {
               for(T plugin : constructorAnnotationPlugins)
               {
                  if (isApplyPhase)
                     applyPlugin(plugin, ci, cmdr, handle);
                  else
                     cleanPlugin(plugin, ci, cmdr, handle);
               }
            }
            else if (trace)
               log.trace("No annotations for " + ci);
         }
      }
      else if (trace)
         log.trace("No constructors");

      // properties
      Set<MethodInfo> visitedMethods = new HashSet<MethodInfo>();
      Set<PropertyInfo> properties = info.getProperties();
      if (properties != null && properties.isEmpty() == false)
      {
         for(PropertyInfo pi : properties)
         {
            FieldInfo field = pi.getFieldInfo();
            if (field != null)
            {
               Signature sis = new FieldSignature(field);
               MetaData cmdr = retrieval.getComponentMetaData(sis);
               if (cmdr != null)
               {
                  for(T plugin : fieldAnnotationPlugins)
                  {
                     if (isApplyPhase)
                        applyPlugin(plugin, field, cmdr, handle);
                     else
                        cleanPlugin(plugin, field, cmdr, handle);
                  }
               }
               else if (trace)
                  log.trace("No annotations for field " + field.getName());
            }
            // apply setter and getter as well - if they exist
            handleMethod(retrieval, handle, isApplyPhase, trace, visitedMethods, pi, pi.getSetter(), "setter");
            handleMethod(retrieval, handle, isApplyPhase, trace, visitedMethods, pi, pi.getGetter(), "getter");
         }
      }
      else if (trace)
         log.trace("No properties");

      // methods
      Set<MethodInfo> methods = info.getMethods();
      if (methods != null && methods.isEmpty() == false)
      {
         for(MethodInfo mi : methods)
         {
            if (visitedMethods.contains(mi) == false)
            {
               Signature mis = new MethodSignature(mi);
               MetaData cmdr = retrieval.getComponentMetaData(mis);
               if (cmdr != null)
               {
                  for(T plugin : methodAnnotationPlugins)
                  {
                     if (isApplyPhase)
                        applyPlugin(plugin, mi, cmdr, handle);
                     else
                        cleanPlugin(plugin, mi, cmdr, handle);
                  }
               }
               else if (trace)
                  log.trace("No annotations for " + mi);
            }
         }
      }
      else if (trace)
         log.trace("No methods");

      // static methods
      MethodInfo[] staticMethods = getStaticMethods(classInfo);
      if (staticMethods != null && staticMethods.length != 0)
      {
         for(MethodInfo smi : staticMethods)
         {
            if (smi.isStatic() && smi.isPublic())
            {
               Signature mis = new MethodSignature(smi);
               MetaData cmdr = retrieval.getComponentMetaData(mis);
               if (cmdr != null)
               {
                  for(T plugin : methodAnnotationPlugins)
                  {
View Full Code Here

   {
      if (method == null)
         return;
     
      visitedMethods.add(method);
      Signature sis = new MethodSignature(method);
      MetaData cmdr = retrieval.getComponentMetaData(sis);
      if (cmdr != null)
      {
         for(T plugin : propertyAnnotationPlugins)
         {
View Full Code Here

      Set<ConstructorInfo> constructors = info.getConstructors();
      if (constructors != null && constructors.isEmpty() == false)
      {
         for(ConstructorInfo ci : constructors)
         {
            Signature cis = new ConstructorSignature(Configurator.getParameterTypes(trace, ci.getParameterTypes()));
            MetaData cmdr = retrieval.getComponentMetaData(cis);
            if (cmdr != null)
            {
               for(AnnotationPlugin plugin : constructorAnnotationPlugins)
               {
                  if (isApplyPhase)
                     plugin.applyAnnotation(ci, cmdr, visitor);
                  else
                     plugin.cleanAnnotation(ci, cmdr, visitor);
               }
            }
            else if (trace)
               log.trace("No annotations for " + ci);
         }
      }
      else if (trace)
         log.trace("No constructors");

      // properties
      Set<MethodInfo> visitedMethods = new HashSet<MethodInfo>();
      Set<PropertyInfo> properties = info.getProperties();
      if (properties != null && properties.isEmpty() == false)
      {
         for(PropertyInfo pi : properties)
         {
            MethodInfo setter = pi.getSetter();
            if (setter != null)
            {
               visitedMethods.add(setter);
               Signature sis = new MethodSignature(setter);
               MetaData cmdr = retrieval.getComponentMetaData(sis);
               if (cmdr != null)
               {
                  for(AnnotationPlugin plugin : propertyAnnotationPlugins)
                  {
                     if (isApplyPhase)
                        plugin.applyAnnotation(pi, cmdr, visitor);
                     else
                        plugin.cleanAnnotation(pi, cmdr, visitor);
                  }
               }
               else if (trace)
                  log.trace("No annotations for property " + pi.getName());
            }
         }
      }
      else if (trace)
         log.trace("No properties");

      // methods
      Set<MethodInfo> methods = info.getMethods();
      if (methods != null && methods.isEmpty() == false)
      {
         for(MethodInfo mi : methods)
         {
            if (visitedMethods.contains(mi) == false)
            {
               Signature mis = new MethodSignature(mi);
               MetaData cmdr = retrieval.getComponentMetaData(mis);
               if (cmdr != null)
               {
                  for(AnnotationPlugin plugin : methodAnnotationPlugins)
                  {
                     if (isApplyPhase)
                        plugin.applyAnnotation(mi, cmdr, visitor);
                     else
                        plugin.cleanAnnotation(mi, cmdr, visitor);
                  }
               }
               else if (trace)
                  log.trace("No annotations for " + mi);
            }
         }
      }
      else if (trace)
         log.trace("No methods");

      // static methods
      MethodInfo[] staticMethods = classInfo.getDeclaredMethods();
      if (staticMethods != null && staticMethods.length != 0)
      {
         for(MethodInfo smi : staticMethods)
         {
            if (smi.isStatic() && smi.isPublic())
            {
               Signature mis = new MethodSignature(smi);
               MetaData cmdr = retrieval.getComponentMetaData(mis);
               if (cmdr != null)
               {
                  for(AnnotationPlugin plugin : methodAnnotationPlugins)
                  {
                     if (isApplyPhase)
                        plugin.applyAnnotation(smi, cmdr, visitor);
                     else
                        plugin.cleanAnnotation(smi, cmdr, visitor);
                  }
               }
               else if (trace)
                  log.trace("No annotations for " + smi);
            }
         }
      }
      else if (trace)
         log.trace("No static methods");

      // fields
      FieldInfo[] fields = classInfo.getDeclaredFields();
      if (fields != null && fields.length > 0)
      {
         for(FieldInfo fi : fields)
         {
            Signature fis = new FieldSignature(fi.getName());
            MetaData cmdr = retrieval.getComponentMetaData(fis);
            if (cmdr != null)
            {
               for(AnnotationPlugin plugin : fieldAnnotationPlugins)
               {
View Full Code Here

      Set<ConstructorInfo> constructors = info.getConstructors();
      if (constructors != null && constructors.isEmpty() == false)
      {
         for(ConstructorInfo ci : constructors)
         {
            Signature cis = new ConstructorSignature(ci);
            MetaData cmdr = retrieval.getComponentMetaData(cis);
            if (cmdr != null)
            {
               for(T plugin : getPlugins(ElementType.CONSTRUCTOR, null, annotationClasses))
               {
                  if (isApplyPhase)
                     applyPlugin(plugin, ci, cmdr, handle);
                  else
                     cleanPlugin(plugin, ci, cmdr, handle);
               }
            }
            else if (trace)
               log.trace("No annotations for " + ci);
         }
      }
      else if (trace)
         log.trace("No constructors");

      // properties
      Set<MethodInfo> visitedMethods = new HashSet<MethodInfo>();
      Set<PropertyInfo> properties = info.getProperties();
      if (properties != null && properties.isEmpty() == false)
      {
         for(PropertyInfo pi : properties)
         {
            FieldInfo field = pi.getFieldInfo();
            if (field != null)
            {
               Signature sis = new FieldSignature(field);
               MetaData cmdr = retrieval.getComponentMetaData(sis);
               if (cmdr != null)
               {
                  for(T plugin : getPlugins(ElementType.FIELD, null, annotationClasses))
                  {
                     if (isApplyPhase)
                        applyPlugin(plugin, field, cmdr, handle);
                     else
                        cleanPlugin(plugin, field, cmdr, handle);
                  }
               }
               else if (trace)
                  log.trace("No annotations for field " + field.getName());
            }
            // apply setter and getter as well - if they exist
            handleMethod(retrieval, handle, isApplyPhase, trace, visitedMethods, pi, pi.getSetter(), "setter", annotationClasses);
            handleMethod(retrieval, handle, isApplyPhase, trace, visitedMethods, pi, pi.getGetter(), "getter", annotationClasses);
         }
      }
      else if (trace)
         log.trace("No properties");

      // get Object's class info - it's cached so it shouldn't take much
      TypeInfoFactory tif = classInfo.getTypeInfoFactory();
      TypeInfo objectTI = tif.getTypeInfo(Object.class);

      // method plugins
      Iterable<T> methodPlugins = null;

      // methods
      Set<MethodInfo> methods = info.getMethods();
      if (methods != null && methods.isEmpty() == false)
      {
         for(MethodInfo mi : methods)
         {
            ClassInfo declaringCI = mi.getDeclaringClass();
            // direct == check is OK
            if (declaringCI != objectTI && visitedMethods.contains(mi) == false)
            {
               Signature mis = new MethodSignature(mi);
               MetaData cmdr = retrieval.getComponentMetaData(mis);
               if (cmdr != null)
               {
                  if (methodPlugins == null)
                     methodPlugins = getPlugins(ElementType.METHOD, METHOD_FILTER, annotationClasses);
                 
                  for(T plugin : methodPlugins)
                  {
                     if (isApplyPhase)
                        applyPlugin(plugin, mi, cmdr, handle);
                     else
                        cleanPlugin(plugin, mi, cmdr, handle);
                  }
               }
               else if (trace)
                  log.trace("No annotations for " + mi);
            }
         }
      }
      else if (trace)
         log.trace("No methods");

      // static methods
      MethodInfo[] staticMethods = getStaticMethods(classInfo);
      if (staticMethods != null && staticMethods.length != 0)
      {
         for(MethodInfo smi : staticMethods)
         {
            if (smi.isStatic() && smi.isPublic())
            {
               Signature mis = new MethodSignature(smi);
               MetaData cmdr = retrieval.getComponentMetaData(mis);
               if (cmdr != null)
               {
                  if (methodPlugins == null)
                     methodPlugins = getPlugins(ElementType.METHOD, METHOD_FILTER, annotationClasses);
View Full Code Here

TOP

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

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.