Examples of DeclaredMethodSignature


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

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

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

   {
      AnnotatedElementMetaDataLoader annotatedElementLoader = new AnnotatedElementMetaDataLoader(BridgeMethodBean.class);

      Method method = BridgeMethodBean.class.getMethod("unambiguous", Object.class);
      assertTrue(method.isBridge());
      Signature methodSignature = new DeclaredMethodSignature(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 DeclaredMethodSignature(method);
      assertNull(annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature));
   }
View Full Code Here

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

   {
      AnnotatedElementMetaDataLoader annotatedElementLoader = new AnnotatedElementMetaDataLoader(BridgeMethodChildBean.class);

      Method method = BridgeMethodChildBean.class.getMethod("unambiguous", Object.class);
      assertTrue(method.isBridge());
      Signature methodSignature = new DeclaredMethodSignature(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 DeclaredMethodSignature(method);
      assertNull(annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature));
   }
View Full Code Here

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

      // Ensure that the bridged method was picked up
      assertTrue("Method " + method + " was expected to be a bridged method", method.isBridge());

      // now just get the ComponentMetaDataRetrieval (which internally triggers the call to search for the
      // non-bridged method).
      Signature methodSignature = new DeclaredMethodSignature(method);
      MetaDataRetrieval retrieval = annotatedElementLoader.getComponentMetaDataRetrieval(methodSignature);
      assertNotNull("Expected a MetaDataRetrieval for method " + method, retrieval);
   }
View Full Code Here

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

  
   public void testSubClassMethodConstructor() throws Exception
   {
      MetaData metaData = createMetaData();
      Method method = TestSub.class.getDeclaredMethod("doSomething");
      doTest(metaData.getComponentMetaData(new DeclaredMethodSignature(method)), "sub");
   }
View Full Code Here

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

   }
  
   public void testSubClassStringConstructor() throws Exception
   {
      MetaData metaData = createMetaData();
      doTest(metaData.getComponentMetaData(new DeclaredMethodSignature(TestSub.class.getName(), "doSomething")), "sub");
   }
View Full Code Here

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

  
   public void testSuperClassMethodConstructor() throws Exception
   {
      MetaData metaData = createMetaData();
      Method method = TestSuper.class.getDeclaredMethod("doSomething");
      doTest(metaData.getComponentMetaData(new DeclaredMethodSignature(method)), "super");
   }
View Full Code Here

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

   }
  
   public void testSuperClassStringConstructor() throws Exception
   {
      MetaData metaData = createMetaData();
      doTest(metaData.getComponentMetaData(new DeclaredMethodSignature(TestSuper.class.getName(), "doSomething")), "super");
   }
View Full Code Here

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

      assertTrue(sig2.equals(sig1));
   }
  
   public void testEqualsDeclaredMethodSignature() throws Exception
   {
      DeclaredMethodSignature sig1 = getDeclaredMethodSignature();
      DeclaredMethodSignature sig2 = getDeclaredMethodSignature();
      assertEquals(sig1.hashCode(), sig2.hashCode());
      assertTrue(sig1.equals(sig2));
      assertTrue(sig2.equals(sig1));
   }
View Full Code Here

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

  
   @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
TOP
Copyright © 2018 www.massapi.com. 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.