Package org.jboss.metadata.spi.signature

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


      ConstructorInfo ci = getConstructorInfo();
      Signature sc = new ConstructorSignature(c);
      checkMetaDataCycle(sc, c, ci);
      Method m = getMethod();
      MethodInfo mi = getMethodInfo();
      Signature sm = new MethodSignature(m);
      checkMetaDataCycle(sm, m, mi);
      Field f = getField();
      FieldInfo fi = getFieldInfo();
      Signature sf = new FieldSignature(f);
      checkMetaDataCycle(sf, f, fi);
View Full Code Here


   protected MetaData setupMethod()
   {
      MemoryMetaDataLoader loader = new MemoryMetaDataLoader();
      MemoryMetaDataLoader component = new MemoryMetaDataLoader();
      loader.addComponentMetaDataRetrieval(new MethodSignature("empty"), component);
      component = new MemoryMetaDataLoader();
      component.addAnnotation(new TestAnnotationImpl());
      loader.addComponentMetaDataRetrieval(new MethodSignature("testAnnotation", String.class), component);
      component = new MemoryMetaDataLoader();
      component.addAnnotation(new TestAnnotation1Impl());
      component.addAnnotation(new TestAnnotation2Impl());
      loader.addComponentMetaDataRetrieval(new MethodSignature("testAnnotation12", String.class, Class.class), component);
      return new MetaDataRetrievalToMetaDataBridge(loader);
   }
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

   {
      AnnotatedElementMetaDataLoader annotatedElementLoader = new AnnotatedElementMetaDataLoader(BridgeMethodBean.class);
     
      Method method = BridgeMethodBean.class.getMethod("unambiguous", Object.class);
      assertTrue(method.isBridge());
      MethodSignature methodSignature = new MethodSignature(method);
      MetaDataRetrieval retrieval = annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature);
      assertNotNull("Expected a MetaDataRetrieval for method " + method, retrieval);
      MetaData metadata = new MetaDataRetrievalToMetaDataBridge(retrieval);
      Annotation[] annotations = metadata.getAnnotations();
      assertTrue("Expected one annotation on unambiguous method of " + BridgeMethodBean.class, annotations.length == 1);
     
      method = BridgeMethodBean.class.getMethod("ambiguous", Object.class);
      assertTrue(method.isBridge());
      methodSignature = new MethodSignature(method);
      assertNull(annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature));
   }
View Full Code Here

   {
      AnnotatedElementMetaDataLoader annotatedElementLoader = new AnnotatedElementMetaDataLoader(BridgeMethodChildBean.class);
     
      Method method = BridgeMethodChildBean.class.getMethod("unambiguous", Object.class);
      assertTrue(method.isBridge());
      MethodSignature methodSignature = new MethodSignature(method);
      MetaDataRetrieval retrieval = annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature);
      assertNotNull("Expected a MetaDataRetrieval for method " + method, retrieval);
      MetaData metadata = new MetaDataRetrievalToMetaDataBridge(retrieval);
      Annotation[] annotations = metadata.getAnnotations();
      assertTrue("Expected one annotation on unambiguous method of " + BridgeMethodChildBean.class, annotations.length == 1);
     
      method = BridgeMethodChildBean.class.getMethod("ambiguous", Object.class);
      assertTrue(method.isBridge());
      methodSignature = new MethodSignature(method);
      assertNull(annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature));
   }
View Full Code Here

   }
  
   public void testNotPublicMethod() throws Exception
   {
      MetaData metaData = createMetaData();
      testTestAnnotation(metaData.getComponentMetaData(new MethodSignature("notPublic")));
   }
View Full Code Here

   }
  
   public void testNotPublicMethodSuperClass() throws Exception
   {
      MetaData metaData = createMetaData();
      testTestAnnotation(metaData.getComponentMetaData(new MethodSignature("notPublicSuperClass")));
   }
View Full Code Here

      return suite(SignatureEqualsUnitTestCase.class);
   }

   public void testEqualsMethodSignature() throws Exception
   {
      MethodSignature sig1 = getMethodSignature();
      MethodSignature sig2 = getMethodSignature();
      assertEquals(sig1.hashCode(), sig2.hashCode());
      assertTrue(sig1.equals(sig2));
      assertTrue(sig2.equals(sig1));
   }
View Full Code Here

   }
  
   @SuppressWarnings({"EqualsBetweenInconvertibleTypes"})
   public void testEqualsMethodSignatureAndDeclaredMethodSignature() throws Exception
   {
      MethodSignature ms = getMethodSignature();
      DeclaredMethodSignature ds = getDeclaredMethodSignature();
      assertEquals(ms.hashCode(), ds.hashCode());
      assertTrue(ms.equals(ds));
      assertTrue(ds.equals(ms));
   }
View Full Code Here

      assertTrue(ds.equals(ms));
   }
  
   protected MethodSignature getMethodSignature() throws Exception
   {
      return new MethodSignature(getMethod());
   }
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.