Package org.jboss.metadata.spi.signature

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


      loader.addAnnotation(annotation);
      repository.addMetaDataRetrieval(loader);
      ScopeKey setStringScope = new ScopeKey(CommonLevels.JOINPOINT, "setString");
      MemoryMetaDataLoader stringProperty = new MemoryMetaDataLoader(setStringScope);
      stringProperty.addAnnotation(annotation);
      Signature signature = new MethodSignature("setString", String.class);
      loader.addComponentMetaDataRetrieval(signature, stringProperty);
     
      KernelDeployment deployment = deploy("MutableMetaDataTestCase_NotAutomatic.xml");
      try
      {
View Full Code Here


    */
   public <T extends Annotation> T resolveTypedAnnotation(long hash, Method m, Class<T> annotation)
   {
      if (metadata != null)
      {
         MethodSignature signature = new MethodSignature(m.getName(), m.getParameterTypes());
         MetaData methodMD = metadata.getComponentMetaData(signature);
         if (methodMD != null)
         {
            T val = methodMD.getAnnotation(annotation);
            if (val != null) return val;
View Full Code Here

      {
         annotation = annotationClass.getName();
      }
      if (metadata != null)
      {
         if (hasJoinPointAnnotation(m.getDeclaringClass(), new MethodSignature(m), annotation))
         {
            return true;
         }
      }
View Full Code Here

   public Object resolveAnnotation(long hash, Method m, Class annotation)
   {
      if (metadata != null)
      {
         MethodSignature signature = new MethodSignature(m.getName(), m.getParameterTypes());
         MetaData methodMD = metadata.getComponentMetaData(signature);
         if (methodMD != null)
         {
            // FIXME The metadata should already include the class annotations
            //       so we should just return this result
View Full Code Here

               // FIXME ClassLoader - this should use "m.getClass().getClassLoader()"
               annotationClass = SecurityActions.getContextClassLoader().loadClass(annotation);
            }
            // FIXME The metadata should already include the class annotations
            //       so we should just return this result
            MethodSignature signature = new MethodSignature(m.getName(), m.getParameterTypes());
            MetaData methodMD = metadata.getComponentMetaData(signature);
            if (methodMD != null)
            {
               if (methodMD.isAnnotationPresent(annotationClass))
                  return true;
View Full Code Here

            }
            return new AnnotatedElementMetaDataLoader(constructor);
         }
         else if (signature instanceof MethodSignature)
         {
            MethodSignature methodSignature = (MethodSignature) signature;
            Method method = methodSignature.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;
            }
            return new AnnotatedElementMetaDataLoader(method);
         }
         else if (signature instanceof DeclaredMethodSignature)
         {
            DeclaredMethodSignature methodSignature = (DeclaredMethodSignature) signature;
            Method method = methodSignature.getMethod();
            if (method == null)
            {
               clazz = getDeclaringClass(clazz, methodSignature.getDeclaringClass());
               if (clazz == null)
                  return null;
               try
               {
                  method = SecurityActions.findDeclaredMethod(clazz, signature.getName(), signature.getParametersTypes(clazz));
View Full Code Here

    */
   public void testMethodLevelAnnotationsWithMethodSignature() throws Exception
   {
      AnnotatedElementMetaDataLoader annotatedElementLoader = new AnnotatedElementMetaDataLoader(MethodBean.class);
      // Create a MethodSignature for the method with 1 annotation
      MethodSignature methodSignature = new MethodSignature("testAnnotation", String.class);
      // create a retrieval out of it
      MetaDataRetrieval retrieval = annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature);
      MetaData metadata = new MetaDataRetrievalToMetaDataBridge(retrieval);
      // should be empty array since the bean has no annotations
      Annotation[] annotations = metadata.getAnnotations();
      assertTrue("Expected one annotation on testAnnotation method of " + MethodBean.class, annotations.length == 1);
     
      // Now try the same on a method which has 2 annotations
      MethodSignature anotherMethodSignature = new MethodSignature("testAnnotation12", String.class, Class.class);
      // create a retrieval out of it
      MetaDataRetrieval anotherRetrieval = annotatedElementLoader.getComponentMetaDataRetrieval(anotherMethodSignature);
      MetaData anotherMetadata = new MetaDataRetrievalToMetaDataBridge(anotherRetrieval);
      // should be empty array since the bean has no annotations
      Annotation[] annotationsOnMethodWithTwoAnnotations = anotherMetadata.getAnnotations();
View Full Code Here

    */
   public <T extends Annotation> T resolveTypedAnnotation(long hash, Method m, Class<T> annotation)
   {
      if (metadata != null)
      {
         MethodSignature signature = new MethodSignature(m.getName(), m.getParameterTypes());
         MetaData methodMD = metadata.getComponentMetaData(signature);
         if (methodMD != null)
         {
            T val = methodMD.getAnnotation(annotation);
            if (val != null) return val;
View Full Code Here

      {
         annotation = annotationClass.getName();
      }
      if (metadata != null)
      {
         if (hasJoinPointAnnotation(m.getDeclaringClass(), new MethodSignature(m), annotation))
         {
            return true;
         }
      }
View Full Code Here

  
   public <T extends Annotation> T resolveTypedAnnotation(long hash, Method m, Class<T> annotation)
   {
      if (metadata != null)
      {
         MethodSignature signature = new MethodSignature(m.getName(), m.getParameterTypes());
         MetaData methodMD = metadata.getComponentMetaData(signature);
         if (methodMD != null)
         {
            T val = methodMD.getAnnotation(annotation);
            if (val != null) return val;
View Full Code Here

TOP

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

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.