[webbeans-commits] Webbeans SVN: r3419 - ri/trunk/impl/src/main/java/org/jboss/webbeans/bean.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-10 10:21:33 -0400 (Mon, 10 Aug 2009)
New Revision: 3419
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
Log:
Fix specialization bug (named specialized beans weren't mapped properly)
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-08-10 13:49:30 UTC (rev 3418)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-08-10 14:21:33 UTC (rev 3419)
@@ -300,7 +300,6 @@
if (isSpecializing() && getSpecializedBean().getAnnotatedItem().isAnnotationPresent(Named.class))
{
this.name = getSpecializedBean().getName();
- return;
}
manager.getSpecializedBeans().put(getSpecializedBean(), this);
}
15 years, 4 months
[webbeans-commits] Webbeans SVN: r3418 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-10 09:49:30 -0400 (Mon, 10 Aug 2009)
New Revision: 3418
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/CrabSpider.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Plaice.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Sole.java
Log:
Remove ambiguous names
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/CrabSpider.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/CrabSpider.java 2009-08-10 13:46:09 UTC (rev 3417)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/CrabSpider.java 2009-08-10 13:49:30 UTC (rev 3418)
@@ -1,10 +1,8 @@
package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
-import javax.enterprise.inject.Named;
import javax.enterprise.inject.Policy;
@Policy
-@Named
public class CrabSpider extends Spider
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Plaice.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Plaice.java 2009-08-10 13:46:09 UTC (rev 3417)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Plaice.java 2009-08-10 13:49:30 UTC (rev 3418)
@@ -1,9 +1,7 @@
package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
-import javax.enterprise.inject.Named;
@Whitefish
-@Named("whitefish")
final class Plaice implements Animal
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Sole.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Sole.java 2009-08-10 13:46:09 UTC (rev 3417)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Sole.java 2009-08-10 13:49:30 UTC (rev 3418)
@@ -1,10 +1,8 @@
package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
-import javax.enterprise.inject.Named;
@Whitefish
@Expensive(veryExpensive = false, cost = 100)
-@Named("whitefish")
class Sole implements ScottishFish
{
15 years, 4 months
[webbeans-commits] Webbeans SVN: r3417 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-10 09:46:09 -0400 (Mon, 10 Aug 2009)
New Revision: 3417
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BlackWidowProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/NullSpiderProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/NullSpiderProducer_Broken.java
Log:
Remove ambiguous names
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BlackWidowProducer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BlackWidowProducer.java 2009-08-10 13:22:35 UTC (rev 3416)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/BlackWidowProducer.java 2009-08-10 13:46:09 UTC (rev 3417)
@@ -1,13 +1,11 @@
package org.jboss.jsr299.tck.tests.implementation.producer.field.lifecycle;
-import javax.enterprise.inject.Named;
import javax.enterprise.inject.Produces;
public class BlackWidowProducer
{
public static BlackWidow blackWidow = new BlackWidow();
@Produces @Tame
- @Named("blackWidow")
public BlackWidow produceBlackWidow = blackWidow;
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/NullSpiderProducer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/NullSpiderProducer.java 2009-08-10 13:22:35 UTC (rev 3416)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/NullSpiderProducer.java 2009-08-10 13:46:09 UTC (rev 3417)
@@ -17,7 +17,6 @@
package org.jboss.jsr299.tck.tests.implementation.producer.field.lifecycle;
-import javax.enterprise.inject.Named;
import javax.enterprise.inject.Produces;
/**
@@ -29,6 +28,6 @@
*/
public class NullSpiderProducer
{
- @Produces @Named("blackWidow") @Null @Working public BlackWidow produceBlackWidow = null;
+ @Produces @Null @Working public BlackWidow produceBlackWidow = null;
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/NullSpiderProducer_Broken.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/NullSpiderProducer_Broken.java 2009-08-10 13:22:35 UTC (rev 3416)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/lifecycle/NullSpiderProducer_Broken.java 2009-08-10 13:46:09 UTC (rev 3417)
@@ -18,7 +18,6 @@
package org.jboss.jsr299.tck.tests.implementation.producer.field.lifecycle;
import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.Named;
import javax.enterprise.inject.Produces;
/**
@@ -30,6 +29,6 @@
*/
public class NullSpiderProducer_Broken
{
- @Produces @RequestScoped @Named("blackWidow") @Null @Broken public BlackWidow produceBlackWidow = null;
+ @Produces @RequestScoped @Null @Broken public BlackWidow produceBlackWidow = null;
}
15 years, 4 months
[webbeans-commits] Webbeans SVN: r3416 - in tck/trunk: impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-08-10 09:22:35 -0400 (Mon, 10 Aug 2009)
New Revision: 3416
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Hallway.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/HallwayBinding.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Interior.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/InteriorDecorator.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/InteriorHallway.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/InteriorRoom.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Room.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/RoomBinding.java
Modified:
tck/trunk/doc/reference/en-US/reporting.xml
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java
Log:
dependent context tests
Modified: tck/trunk/doc/reference/en-US/reporting.xml
===================================================================
--- tck/trunk/doc/reference/en-US/reporting.xml 2009-08-09 21:59:46 UTC (rev 3415)
+++ tck/trunk/doc/reference/en-US/reporting.xml 2009-08-10 13:22:35 UTC (rev 3416)
@@ -233,7 +233,7 @@
</itemizedlist>
<para>
- For reasons provided in the tck-audit.xml document and presented in
+ For reasons provided in the <literal>tck-audit.xml</literal> document and presented in
the coverage report, some assertions are not testable.
</para>
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java 2009-08-09 21:59:46 UTC (rev 3415)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/DependentContextTest.java 2009-08-10 13:22:35 UTC (rev 3416)
@@ -9,11 +9,11 @@
import javax.enterprise.inject.AnnotationLiteral;
import javax.enterprise.inject.spi.Bean;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.impl.MockCreationalContext;
import org.jboss.test.audit.annotations.SpecAssertion;
import org.jboss.test.audit.annotations.SpecAssertions;
import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.jsr299.tck.impl.MockCreationalContext;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
import org.testng.annotations.Test;
@@ -346,4 +346,30 @@
assert HorseStable.getInstanceThatObservedEvent() != null;
assert HorseStable.isDestroyed();
}
+
+ @Test(groups = { "contexts", "broken" })
+ @SpecAssertion(section = "6.4.1", id = "ab")
+ public void testDependentScopedDecoratorsAreDependentObjectsOfBean()
+ {
+ Bean<Interior> roomBean = getBeans(Interior.class, new RoomBinding()).iterator().next();
+ Bean<Interior> hallwayBean = getBeans(Interior.class, new HallwayBinding()).iterator().next();
+
+ CreationalContext<Interior> roomCreationalContext = getCurrentManager().createCreationalContext(roomBean);
+ CreationalContext<Interior> hallwayCreationalContext = getCurrentManager().createCreationalContext(hallwayBean);
+
+ Interior room = roomBean.create(roomCreationalContext);
+ Interior hallway = hallwayBean.create(hallwayCreationalContext);
+
+ InteriorDecorator.instances.clear();
+
+ room.foo();
+
+ assert InteriorDecorator.instances.size() > 0;
+ assert InteriorDecorator.instances.size() == 1;
+
+ hallway.foo();
+
+ assert InteriorDecorator.instances.size() == 2;
+ assert !InteriorDecorator.instances.get(0).equals(InteriorDecorator.instances.get(1));
+ }
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Hallway.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Hallway.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Hallway.java 2009-08-10 13:22:35 UTC (rev 3416)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.context.dependent;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@interface Hallway
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/HallwayBinding.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/HallwayBinding.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/HallwayBinding.java 2009-08-10 13:22:35 UTC (rev 3416)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.context.dependent;
+
+import javax.enterprise.inject.AnnotationLiteral;
+
+class HallwayBinding extends AnnotationLiteral<Hallway> implements Hallway
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Interior.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Interior.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Interior.java 2009-08-10 13:22:35 UTC (rev 3416)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.context.dependent;
+
+interface Interior
+{
+ public void foo();
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/InteriorDecorator.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/InteriorDecorator.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/InteriorDecorator.java 2009-08-10 13:22:35 UTC (rev 3416)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.context.dependent;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.decorator.Decorates;
+import javax.decorator.Decorator;
+
+@Decorator
+class InteriorDecorator
+{
+ @Decorates Interior interior;
+
+ public static List<InteriorDecorator> instances = new ArrayList<InteriorDecorator>();
+
+ public void foo()
+ {
+ instances.add(this);
+ interior.foo();
+ }
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/InteriorHallway.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/InteriorHallway.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/InteriorHallway.java 2009-08-10 13:22:35 UTC (rev 3416)
@@ -0,0 +1,13 @@
+package org.jboss.jsr299.tck.tests.context.dependent;
+
+@Hallway
+class InteriorHallway implements Interior
+{
+
+ public void foo()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/InteriorRoom.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/InteriorRoom.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/InteriorRoom.java 2009-08-10 13:22:35 UTC (rev 3416)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.context.dependent;
+
+@Room
+class InteriorRoom implements Interior
+{
+ public void foo()
+ {
+ // TODO Auto-generated method stub
+
+ }
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Room.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Room.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/Room.java 2009-08-10 13:22:35 UTC (rev 3416)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.context.dependent;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.BindingType;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@interface Room
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/RoomBinding.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/RoomBinding.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/dependent/RoomBinding.java 2009-08-10 13:22:35 UTC (rev 3416)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.context.dependent;
+
+import javax.enterprise.inject.AnnotationLiteral;
+
+class RoomBinding extends AnnotationLiteral<Room> implements Room
+{
+
+}
15 years, 4 months
[webbeans-commits] Webbeans SVN: r3415 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/byname/duplicatePrefixResolution and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-09 17:59:46 -0400 (Sun, 09 Aug 2009)
New Revision: 3415
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/byname/duplicatePrefixResolution/DuplicateNamePrefixResolutionTest.java
Log:
WBRI-305
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-08-09 21:50:07 UTC (rev 3414)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-08-09 21:59:46 UTC (rev 3415)
@@ -1217,6 +1217,12 @@
return namespaces;
}
+ public Iterable<String> getAccessibleNamespaces()
+ {
+ // TODO Cache this
+ return createDynamicAccessibleIterable(Transform.NAMESPACE);
+ }
+
protected AtomicInteger getIds()
{
return ids;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-08-09 21:50:07 UTC (rev 3414)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-08-09 21:59:46 UTC (rev 3415)
@@ -230,6 +230,13 @@
namedAccessibleBeans.put(bean.getName(), bean);
}
}
+
+ List<String> accessibleNamespaces = new ArrayList<String>();
+ for (String namespace : beanManager.getAccessibleNamespaces())
+ {
+ accessibleNamespaces.add(namespace);
+ }
+
for (String name : namedAccessibleBeans.keySet())
{
Set<Bean<?>> resolvedBeans = beanManager.getBeanResolver().resolve(namedAccessibleBeans.get(name));
@@ -237,6 +244,10 @@
{
throw new DeploymentException("An unresolvable ambiguous EL name exists for " + name + "; found " + resolvedBeans );
}
+ if (accessibleNamespaces.contains(name))
+ {
+ throw new DeploymentException("The bean name " + name + " is used as a prefix for another bean");
+ }
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/byname/duplicatePrefixResolution/DuplicateNamePrefixResolutionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/byname/duplicatePrefixResolution/DuplicateNamePrefixResolutionTest.java 2009-08-09 21:50:07 UTC (rev 3414)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/byname/duplicatePrefixResolution/DuplicateNamePrefixResolutionTest.java 2009-08-09 21:59:46 UTC (rev 3415)
@@ -17,10 +17,10 @@
package org.jboss.jsr299.tck.tests.lookup.byname.duplicatePrefixResolution;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecVersion;
import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.jsr299.tck.DeploymentError;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecVersion;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
import org.testng.annotations.Test;
@@ -31,9 +31,8 @@
public class DuplicateNamePrefixResolutionTest extends AbstractJSR299Test
{
- @Test(groups = { "resolution", "el", "ri-broken" })
+ @Test(groups = { "resolution", "el"})
@SpecAssertion(section = "5.4.1", id = "db")
- // WBRI-305
public void testDuplicateBeanNamePrefix()
{
assert false;
15 years, 4 months
[webbeans-commits] Webbeans SVN: r3414 - ri/trunk/impl/src/main/java/org/jboss/webbeans/bean and 17 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-09 17:50:07 -0400 (Sun, 09 Aug 2009)
New Revision: 3414
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/SimpleInjectionTarget.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBCallable.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBCallable.java
Removed:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBType.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBType.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBType.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/DecoratorProxyMethodHandler.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverFactory.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverMethodImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBAnnotation.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBConstructor.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBField.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBMember.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBMethod.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBParameter.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBAnnotation.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBConstructor.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBField.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBMember.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBMethod.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBParameter.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBMember.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/ConstructorSignatureImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/MethodSignatureImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBAnnotationImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBConstructorImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBFieldImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBMethodImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBParameterImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/BindingTypeModel.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeBeanResolver.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/CustomBeanImplementationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/annotated/AlternativeMetaDataTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/BeanManagerTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/byname/duplicateNameResolution/DuplicateNameResolutionTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java
tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
WBRI-304, WBRI-325, WBRI-309
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -86,6 +86,7 @@
import org.jboss.webbeans.resolution.TypeSafeDecoratorResolver;
import org.jboss.webbeans.resolution.TypeSafeObserverResolver;
import org.jboss.webbeans.resolution.TypeSafeResolver;
+import org.jboss.webbeans.resources.ClassTransformer;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.Proxies;
import org.jboss.webbeans.util.Reflections;
@@ -743,6 +744,11 @@
{
return Collections.unmodifiableList(decorators);
}
+
+ public Iterable<Bean<?>> getAccessibleBeans()
+ {
+ return createDynamicAccessibleIterable(Transform.BEAN);
+ }
/**
* Get all the spec defined beans, including interceptor beans and decorator
@@ -1241,14 +1247,10 @@
return rootNamespace;
}
- public <T> InjectionTarget<T> createInjectionTarget(Class<T> type)
- {
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
public <T> InjectionTarget<T> createInjectionTarget(AnnotatedType<T> type)
{
- throw new UnsupportedOperationException("Not yet implemented");
+ // TODO Cache on our side?
+ return new SimpleInjectionTarget<T>(getServices().get(ClassTransformer.class).loadClass(type), this);
}
public <X> Bean<? extends X> getMostSpecializedBean(Bean<X> bean)
@@ -1329,7 +1331,7 @@
public <T> AnnotatedType<T> createAnnotatedType(Class<T> type)
{
- throw new UnsupportedOperationException();
+ return getServices().get(ClassTransformer.class).loadClass(type);
}
public <X> Bean<? extends X> resolve(Set<Bean<? extends X>> beans)
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/SimpleInjectionTarget.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/SimpleInjectionTarget.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/SimpleInjectionTarget.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -0,0 +1,113 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+import org.jboss.webbeans.injection.ConstructorInjectionPoint;
+import org.jboss.webbeans.injection.FieldInjectionPoint;
+import org.jboss.webbeans.injection.MethodInjectionPoint;
+import org.jboss.webbeans.introspector.WBClass;
+import org.jboss.webbeans.introspector.WBMethod;
+import org.jboss.webbeans.util.Beans;
+
+/**
+ * @author pmuir
+ *
+ */
+public class SimpleInjectionTarget<T> implements InjectionTarget<T>
+{
+
+ private final BeanManagerImpl beanManager;
+ private final WBClass<T> type;
+ private final ConstructorInjectionPoint<T> constructor;
+ private final Set<FieldInjectionPoint<?, ?>> injectableFields;
+ private final Set<MethodInjectionPoint<?, ?>> initializerMethods;
+ private final WBMethod<?, ?> postConstruct;
+ private final WBMethod<?, ?> preDestroy;
+ private final Set<InjectionPoint> injectionPoints;
+
+ public SimpleInjectionTarget(WBClass<T> type, BeanManagerImpl beanManager)
+ {
+ this.beanManager = beanManager;
+ this.type = type;
+ this.injectionPoints = new HashSet<InjectionPoint>();
+ this.constructor = Beans.getBeanConstructor(null, type);
+ this.injectionPoints.addAll(Beans.getParameterInjectionPoints(null, constructor));
+ this.injectableFields = new HashSet<FieldInjectionPoint<?,?>>();
+ this.injectableFields.addAll(Beans.getFieldInjectionPoints(null, type));
+ this.injectionPoints.addAll(injectableFields);
+ this.initializerMethods = new HashSet<MethodInjectionPoint<?,?>>();
+ this.initializerMethods.addAll(Beans.getInitializerMethods(null, type));
+ this.injectionPoints.addAll(Beans.getParameterInjectionPoints(null, initializerMethods));
+ this.postConstruct = Beans.getPostConstruct(type);
+ this.preDestroy = Beans.getPreDestroy(type);
+ }
+
+ public T produce(CreationalContext<T> ctx)
+ {
+ return constructor.newInstance(beanManager, ctx);
+ }
+
+ public void inject(T instance, CreationalContext<T> ctx)
+ {
+ for (FieldInjectionPoint<?, ?> injectionPoint : injectableFields)
+ {
+ injectionPoint.inject(instance, beanManager, ctx);
+ }
+ }
+
+ public void postConstruct(T instance)
+ {
+ try
+ {
+ postConstruct.invoke(instance);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Error invoking postConstruct() " + postConstruct, e);
+ }
+ }
+
+ public void preDestroy(T instance)
+ {
+ try
+ {
+ preDestroy.invoke(instance);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Error invoking preDestroy() " + preDestroy, e);
+ }
+ }
+
+ public void dispose(T instance)
+ {
+ // No-op
+ }
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return injectionPoints;
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/SimpleInjectionTarget.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -22,6 +22,8 @@
import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -54,6 +56,10 @@
import org.jboss.webbeans.util.Proxies;
import org.jboss.webbeans.util.Reflections;
+import com.google.common.base.Supplier;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Multimaps;
+
/**
* Checks a list of beans for DeploymentExceptions and their subclasses
*
@@ -203,9 +209,37 @@
validateEnabledDecoratorClasses(manager);
validateEnabledPolicies(manager);
validateDisposalMethods(environment);
-
+ validateBeanNames(manager);
}
+ public void validateBeanNames(BeanManagerImpl beanManager)
+ {
+ Multimap<String, Bean<?>> namedAccessibleBeans = Multimaps.newSetMultimap(new HashMap<String, Collection<Bean<?>>>(), new Supplier<Set<Bean<?>>>()
+ {
+
+ public Set<Bean<?>> get()
+ {
+ return new HashSet<Bean<?>>();
+ }
+
+ });
+ for (Bean<?> bean : beanManager.getAccessibleBeans())
+ {
+ if (bean.getName() != null)
+ {
+ namedAccessibleBeans.put(bean.getName(), bean);
+ }
+ }
+ for (String name : namedAccessibleBeans.keySet())
+ {
+ Set<Bean<?>> resolvedBeans = beanManager.getBeanResolver().resolve(namedAccessibleBeans.get(name));
+ if (resolvedBeans.size() > 1)
+ {
+ throw new DeploymentException("An unresolvable ambiguous EL name exists for " + name + "; found " + resolvedBeans );
+ }
+ }
+ }
+
private void validateEnabledDecoratorClasses(BeanManagerImpl beanManager)
{
// TODO Move building this list to the boot or sth
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -256,7 +256,7 @@
Bean<?> resolvedBean = manager.getBeans(injectionPoint.getJavaClass(), bindings).iterator().next();
if (passivating)
{
- if (Dependent.class.equals(resolvedBean.getScopeType()) && !Reflections.isSerializable(resolvedBean.getBeanClass()) && (((injectionPoint instanceof WBField<?>) && !((WBField<?>) injectionPoint).isTransient()) || (injectionPoint instanceof WBParameter<?>)))
+ if (Dependent.class.equals(resolvedBean.getScopeType()) && !Reflections.isSerializable(resolvedBean.getBeanClass()) && (((injectionPoint instanceof WBField<?, ?>) && !((WBField<?, ?>) injectionPoint).isTransient()) || (injectionPoint instanceof WBParameter<?, ?>)))
{
return false;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -31,13 +31,10 @@
import javax.enterprise.context.Dependent;
import javax.enterprise.context.ScopeType;
import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.event.Observes;
import javax.enterprise.inject.CreationException;
-import javax.enterprise.inject.Disposes;
-import javax.enterprise.inject.Initializer;
-import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.Decorator;
import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.DefinitionException;
@@ -45,10 +42,7 @@
import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.injection.FieldInjectionPoint;
import org.jboss.webbeans.injection.MethodInjectionPoint;
-import org.jboss.webbeans.injection.ParameterInjectionPoint;
import org.jboss.webbeans.introspector.WBClass;
-import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.introspector.WBParameter;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.util.Beans;
@@ -63,16 +57,16 @@
* @param <T>
* @param <E>
*/
-public abstract class AbstractClassBean<T> extends AbstractBean<T, Class<T>>
+public abstract class AbstractClassBean<T> extends AbstractBean<T, Class<T>> implements InjectionTarget<T>
{
// Logger
private static final LogProvider log = Logging.getLogProvider(AbstractClassBean.class);
// The item representation
protected WBClass<T> annotatedItem;
// The injectable fields
- private Set<FieldInjectionPoint<?>> injectableFields;
+ private Set<FieldInjectionPoint<?, ?>> injectableFields;
// The initializer methods
- private Set<MethodInjectionPoint<?>> initializerMethods;
+ private Set<MethodInjectionPoint<?, ?>> initializerMethods;
private Set<String> dependencies;
private List<Decorator<?>> decorators;
@@ -212,7 +206,7 @@
*/
protected void injectBoundFields(T instance, CreationalContext<T> creationalContext)
{
- for (FieldInjectionPoint<?> injectableField : injectableFields)
+ for (FieldInjectionPoint<?, ?> injectableField : injectableFields)
{
injectableField.inject(instance, manager, creationalContext);
}
@@ -225,11 +219,17 @@
*/
protected void callInitializers(T instance, CreationalContext<T> creationalContext)
{
- for (MethodInjectionPoint<?> initializer : getInitializerMethods())
+ for (MethodInjectionPoint<?, ?> initializer : getInitializerMethods())
{
initializer.invoke(instance, manager, creationalContext, CreationException.class);
}
}
+
+ public void dispose(T instance)
+ {
+ // No-op for class beans
+ }
+
/**
* Initializes the bean type
@@ -250,7 +250,7 @@
*/
protected void initInjectableFields()
{
- injectableFields = new HashSet<FieldInjectionPoint<?>>(Beans.getFieldInjectionPoints(annotatedItem, this));
+ injectableFields = new HashSet<FieldInjectionPoint<?, ?>>(Beans.getFieldInjectionPoints(this, annotatedItem));
addInjectionPoints(injectableFields);
}
@@ -259,41 +259,14 @@
*/
protected void initInitializerMethods()
{
- initializerMethods = new HashSet<MethodInjectionPoint<?>>();
- for (WBMethod<?> method : annotatedItem.getAnnotatedMethods(Initializer.class))
- {
- if (method.isStatic())
- {
- throw new DefinitionException("Initializer method " + method.toString() + " cannot be static on " + getAnnotatedItem());
- }
- else if (method.getAnnotation(Produces.class) != null)
- {
- throw new DefinitionException("Initializer method " + method.toString() + " cannot be annotated @Produces on " + getAnnotatedItem());
- }
- else if (method.getAnnotatedParameters(Disposes.class).size() > 0)
- {
- throw new DefinitionException("Initializer method " + method.toString() + " cannot have parameters annotated @Disposes on " + getAnnotatedItem());
- }
- else if (method.getAnnotatedParameters(Observes.class).size() > 0)
- {
- throw new DefinitionException("Initializer method " + method.toString() + " cannot be annotated @Observes on " + getAnnotatedItem());
- }
- else
- {
- MethodInjectionPoint<?> initializerMethod = MethodInjectionPoint.of(this, method);
- initializerMethods.add(initializerMethod);
- for (WBParameter<?> parameter : initializerMethod.getParameters())
- {
- addInjectionPoint(ParameterInjectionPoint.of(this, parameter));
- }
- }
- }
+ initializerMethods = Beans.getInitializerMethods(this, getAnnotatedItem());
+ addInjectionPoints(Beans.getParameterInjectionPoints(this, initializerMethods));
}
@Override
protected void initScopeType()
{
- for (WBClass<?> clazz = getAnnotatedItem(); clazz != null; clazz = clazz.getSuperclass())
+ for (WBClass<?> clazz = getAnnotatedItem(); clazz != null; clazz = clazz.getWBSuperclass())
{
Set<Annotation> scopeTypes = clazz.getDeclaredMetaAnnotations(ScopeType.class);
scopeTypes = clazz.getDeclaredMetaAnnotations(ScopeType.class);
@@ -333,7 +306,7 @@
protected void preSpecialize(BeanDeployerEnvironment environment)
{
super.preSpecialize(environment);
- if (getAnnotatedItem().getSuperclass() == null || getAnnotatedItem().getSuperclass().getJavaClass().equals(Object.class))
+ if (getAnnotatedItem().getWBSuperclass() == null || getAnnotatedItem().getWBSuperclass().getJavaClass().equals(Object.class))
{
throw new DefinitionException("Specializing bean must extend another bean " + toString());
}
@@ -368,7 +341,7 @@
*
* @return The set of annotated methods
*/
- public Set<? extends MethodInjectionPoint<?>> getInitializerMethods()
+ public Set<? extends MethodInjectionPoint<?, ?>> getInitializerMethods()
{
return initializerMethods;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -35,6 +35,7 @@
import javax.enterprise.inject.Initializer;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.Producer;
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.DefinitionException;
@@ -55,7 +56,7 @@
* @param <T>
* @param <S>
*/
-public abstract class AbstractProducerBean<T, S extends Member> extends AbstractReceiverBean<T, S>
+public abstract class AbstractProducerBean<T, S extends Member> extends AbstractReceiverBean<T, S> implements Producer<T>
{
private static final LogProvider log = Logging.getLogProvider(AbstractProducerBean.class);
@@ -71,7 +72,7 @@
}
@Override
- protected abstract WBMember<T, S> getAnnotatedItem();
+ protected abstract WBMember<T, ?, S> getAnnotatedItem();
@Override
// Overriden to provide the class of the bean that declares the producer method/field
@@ -271,7 +272,7 @@
{
try
{
- T instance = produceInstance(creationalContext);
+ T instance = produce(creationalContext);
checkReturnValue(instance);
return instance;
}
@@ -284,8 +285,6 @@
}
}
- protected abstract T produceInstance(CreationalContext<T> creationalContext);
-
/**
* Gets a string representation
*
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DecoratorBean.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -118,7 +118,7 @@
{
for (WBInjectionPoint<?, ?> injectionPoint : getDelegateInjectionPoints())
{
- if (injectionPoint instanceof MethodInjectionPoint<?> && !injectionPoint.isAnnotationPresent(Initializer.class))
+ if (injectionPoint instanceof MethodInjectionPoint<?, ?> && !injectionPoint.isAnnotationPresent(Initializer.class))
{
throw new DefinitionException("Method with @Decorates parameter must be an initializer method " + injectionPoint);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -38,10 +38,10 @@
public class DisposalMethodBean<T> extends AbstractReceiverBean<T, Method>
{
- protected MethodInjectionPoint<T> disposalMethodInjectionPoint;
+ protected MethodInjectionPoint<T, ?> disposalMethodInjectionPoint;
private final String id;
- protected DisposalMethodBean(BeanManagerImpl manager, WBMethod<T> disposalMethod, AbstractClassBean<?> declaringBean)
+ protected DisposalMethodBean(BeanManagerImpl manager, WBMethod<T, ?> disposalMethod, AbstractClassBean<?> declaringBean)
{
super(declaringBean, manager);
this.disposalMethodInjectionPoint = MethodInjectionPoint.of(this, disposalMethod);
@@ -66,12 +66,12 @@
}
@Override
- public WBMethod<T> getAnnotatedItem()
+ public WBMethod<T, ?> getAnnotatedItem()
{
return disposalMethodInjectionPoint;
}
- public static <T> DisposalMethodBean<T> of(BeanManagerImpl manager, WBMethod<T> disposalMethod, AbstractClassBean<?> declaringBean)
+ public static <T> DisposalMethodBean<T> of(BeanManagerImpl manager, WBMethod<T, ?> disposalMethod, AbstractClassBean<?> declaringBean)
{
return new DisposalMethodBean<T>(manager, disposalMethod, declaringBean);
}
@@ -81,7 +81,7 @@
{
// At least 1 parameter exists, already checked in constructor
this.bindings = new HashSet<Annotation>();
- this.bindings.addAll(disposalMethodInjectionPoint.getParameters().get(0).getBindings());
+ this.bindings.addAll(disposalMethodInjectionPoint.getWBParameters().get(0).getBindings());
initDefaultBindings();
}
@@ -148,8 +148,9 @@
return null;
}
- public void invokeDisposeMethod(Object instance, CreationalContext<?> creationalContext)
+ public void invokeDisposeMethod(Object instance)
{
+ CreationalContext<T> creationalContext = manager.createCreationalContext(this);
Object receiverInstance = getReceiver(creationalContext);
if (receiverInstance == null)
{
@@ -159,11 +160,12 @@
{
disposalMethodInjectionPoint.invokeOnInstanceWithSpecialValue(receiverInstance, Disposes.class, instance, manager, creationalContext, IllegalArgumentException.class);
}
+ creationalContext.release();
}
private void checkDisposalMethod()
{
- if (!disposalMethodInjectionPoint.getParameters().get(0).isAnnotationPresent(Disposes.class))
+ if (!disposalMethodInjectionPoint.getWBParameters().get(0).isAnnotationPresent(Disposes.class))
{
throw new DefinitionException(disposalMethodInjectionPoint.toString() + " doesn't have @Dispose as first parameter");
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -194,7 +194,7 @@
protected void preSpecialize(BeanDeployerEnvironment environment)
{
super.preSpecialize(environment);
- if (!environment.getEjbDescriptors().containsKey(getAnnotatedItem().getSuperclass().getJavaClass()))
+ if (!environment.getEjbDescriptors().containsKey(getAnnotatedItem().getWBSuperclass().getJavaClass()))
{
throw new DefinitionException("Annotation defined specializing EJB must have EJB superclass");
}
@@ -203,11 +203,11 @@
@Override
protected void specialize(BeanDeployerEnvironment environment)
{
- if (environment.getClassBean(getAnnotatedItem().getSuperclass()) == null)
+ if (environment.getClassBean(getAnnotatedItem().getWBSuperclass()) == null)
{
throw new IllegalStateException(toString() + " does not specialize a bean");
}
- AbstractClassBean<?> specializedBean = environment.getClassBean(getAnnotatedItem().getSuperclass());
+ AbstractClassBean<?> specializedBean = environment.getClassBean(getAnnotatedItem().getWBSuperclass());
if (!(specializedBean instanceof EnterpriseBean))
{
throw new IllegalStateException(toString() + " doesn't have a session bean as a superclass " + specializedBean);
@@ -225,16 +225,37 @@
*/
public T create(final CreationalContext<T> creationalContext)
{
+ T instance = produce(creationalContext);
+ if (hasDecorators())
+ {
+ instance = applyDecorators(instance, creationalContext, null);
+ }
+ return instance;
+ }
+
+ public void inject(T instance, CreationalContext<T> ctx)
+ {
+ throw new UnsupportedOperationException("Unable to perform injection on a session bean");
+ }
+
+ public void postConstruct(T instance)
+ {
+ throw new UnsupportedOperationException("Unable to call postConstruct() on a session bean");
+ }
+
+ public void preDestroy(T instance)
+ {
+ throw new UnsupportedOperationException("Unable to call preDestroy() on a session bean");
+ }
+
+ public T produce(CreationalContext<T> ctx)
+ {
try
{
T instance = proxyClass.newInstance();
- creationalContext.push(instance);
- ((ProxyObject) instance).setHandler(new EnterpriseBeanProxyMethodHandler<T>(this, creationalContext));
+ ctx.push(instance);
+ ((ProxyObject) instance).setHandler(new EnterpriseBeanProxyMethodHandler<T>(this, ctx));
log.trace("Enterprise bean instance created for bean {0}", this);
- if (hasDecorators())
- {
- instance = applyDecorators(instance, creationalContext, null);
- }
return instance;
}
catch (InstantiationException e)
@@ -354,7 +375,7 @@
*/
protected void checkObserverMethods()
{
- for (WBMethod<?> method : this.annotatedItem.getDeclaredMethodsWithAnnotatedParameters(Observes.class))
+ for (WBMethod<?, ?> method : this.annotatedItem.getWBDeclaredMethodsWithAnnotatedParameters(Observes.class))
{
if (!method.isStatic())
{
@@ -367,7 +388,7 @@
}
// TODO must be a nicer way to do this!
- public boolean isMethodExistsOnTypes(WBMethod<?> method)
+ public boolean isMethodExistsOnTypes(WBMethod<?, ?> method)
{
for (Type type : getTypes())
{
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -38,7 +38,7 @@
public class ProducerFieldBean<T> extends AbstractProducerBean<T, Field>
{
// The underlying field
- private WBField<T> field;
+ private WBField<T, ?> field;
private final String id;
/**
@@ -49,7 +49,7 @@
* @param manager the current manager
* @return A producer Web Bean
*/
- public static <T> ProducerFieldBean<T> of(WBField<T> field, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+ public static <T> ProducerFieldBean<T> of(WBField<T, ?> field, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
{
return new ProducerFieldBean<T>(field, declaringBean, manager);
}
@@ -61,7 +61,7 @@
* @param declaringBean The declaring bean
* @param manager The Web Beans manager
*/
- protected ProducerFieldBean(WBField<T> field, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+ protected ProducerFieldBean(WBField<T, ?> field, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
{
super(declaringBean, manager);
this.field = field;
@@ -80,17 +80,19 @@
}
}
+ public void destroy(T instance, CreationalContext<T> creationalContext)
+ {
+ dispose(instance);
+ }
- @Override
- protected T produceInstance(CreationalContext<T> creationalContext)
+ public void dispose(T instance)
{
- return field.get(getReceiver(creationalContext));
+ // No clean up required
}
-
- public void destroy(T instance, CreationalContext<T> creationalContext)
+ public T produce(CreationalContext<T> ctx)
{
-
+ return field.get(getReceiver(ctx));
}
@@ -100,7 +102,7 @@
* @return The annotated item
*/
@Override
- protected WBField<T> getAnnotatedItem()
+ protected WBField<T, ?> getAnnotatedItem()
{
return field;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -46,7 +46,7 @@
public class ProducerMethodBean<T> extends AbstractProducerBean<T, Method>
{
// The underlying method
- private MethodInjectionPoint<T> method;
+ private MethodInjectionPoint<T, ?> method;
private DisposalMethodBean<?> disposalMethodBean;
@@ -62,12 +62,12 @@
* @param manager the current manager
* @return A producer Web Bean
*/
- public static <T> ProducerMethodBean<T> of(WBMethod<T> method, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+ public static <T> ProducerMethodBean<T> of(WBMethod<T, ?> method, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
{
return new ProducerMethodBean<T>(method, declaringBean, manager);
}
- protected ProducerMethodBean(WBMethod<T> method, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+ protected ProducerMethodBean(WBMethod<T, ?> method, AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
{
super(declaringBean, manager);
this.method = MethodInjectionPoint.of(this, method);
@@ -77,7 +77,7 @@
this.id = createId("ProducerMethod-" + declaringBean.getType().getName() + "-" + method.getSignature().toString());
}
- protected T produceInstance(CreationalContext<T> creationalContext)
+ public T produce(CreationalContext<T> creationalContext)
{
Object receiver = getReceiver(creationalContext);
if (receiver != null)
@@ -110,7 +110,7 @@
*/
protected void initProducerMethodInjectableParameters()
{
- for (WBParameter<?> parameter : method.getParameters())
+ for (WBParameter<?, ?> parameter : method.getWBParameters())
{
addInjectionPoint(ParameterInjectionPoint.of(this, parameter));
}
@@ -121,11 +121,11 @@
*/
protected void checkProducerMethod()
{
- if (getAnnotatedItem().getAnnotatedParameters(Observes.class).size() > 0)
+ if (getAnnotatedItem().getAnnotatedWBParameters(Observes.class).size() > 0)
{
throw new DefinitionException("Producer method cannot have parameter annotated @Observes");
}
- else if (getAnnotatedItem().getAnnotatedParameters(Disposes.class).size() > 0)
+ else if (getAnnotatedItem().getAnnotatedWBParameters(Disposes.class).size() > 0)
{
throw new DefinitionException("Producer method cannot have parameter annotated @Disposes");
}
@@ -170,7 +170,7 @@
else if (disposalBeans.size() > 1)
{
// TODO List out found disposal methods
- throw new DefinitionException("Cannot declare multiple disposal methods for this producer method");
+ throw new DefinitionException("Cannot declare multiple disposal methods for this producer method. Producer method: " + this + ". Disposal methods: " + disposalBeans);
}
}
@@ -178,10 +178,7 @@
{
try
{
- if (disposalMethodBean != null)
- {
- disposalMethodBean.invokeDisposeMethod(instance, creationalContext);
- }
+ dispose(instance);
}
finally
{
@@ -191,6 +188,14 @@
}
}
}
+
+ public void dispose(T instance)
+ {
+ if (disposalMethodBean != null)
+ {
+ disposalMethodBean.invokeDisposeMethod(instance);
+ }
+ }
/**
* Gets the annotated item representing the method
@@ -198,7 +203,7 @@
* @return The annotated item
*/
@Override
- public WBMethod<T> getAnnotatedItem()
+ public WBMethod<T, ?> getAnnotatedItem()
{
return method;
}
@@ -255,7 +260,7 @@
@Override
protected void preSpecialize(BeanDeployerEnvironment environment)
{
- if (getDeclaringBean().getAnnotatedItem().getSuperclass().getDeclaredMethod(getAnnotatedItem().getAnnotatedMethod()) == null)
+ if (getDeclaringBean().getAnnotatedItem().getWBSuperclass().getDeclaredWBMethod(getAnnotatedItem().getAnnotatedMethod()) == null)
{
throw new DefinitionException("Specialized producer method does not override a method on the direct superclass");
}
@@ -264,7 +269,7 @@
@Override
protected void specialize(BeanDeployerEnvironment environment)
{
- WBMethod<?> superClassMethod = getDeclaringBean().getAnnotatedItem().getSuperclass().getMethod(getAnnotatedItem().getAnnotatedMethod());
+ WBMethod<?, ?> superClassMethod = getDeclaringBean().getAnnotatedItem().getWBSuperclass().getWBMethod(getAnnotatedItem().getAnnotatedMethod());
if (environment.getProducerMethod(superClassMethod) == null)
{
throw new IllegalStateException(toString() + " does not specialize a bean");
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -20,12 +20,9 @@
import java.util.HashSet;
import java.util.Set;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Disposes;
-import javax.enterprise.inject.Initializer;
import javax.enterprise.inject.spi.Decorator;
import javax.enterprise.inject.spi.InjectionPoint;
@@ -36,19 +33,18 @@
import org.jboss.webbeans.ejb.spi.EjbServices;
import org.jboss.webbeans.injection.ConstructorInjectionPoint;
import org.jboss.webbeans.injection.FieldInjectionPoint;
-import org.jboss.webbeans.injection.ParameterInjectionPoint;
import org.jboss.webbeans.injection.WBInjectionPoint;
import org.jboss.webbeans.introspector.WBClass;
import org.jboss.webbeans.introspector.WBConstructor;
import org.jboss.webbeans.introspector.WBField;
import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.introspector.WBParameter;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.metadata.cache.MetaAnnotationStore;
import org.jboss.webbeans.persistence.PersistenceApiAbstraction;
import org.jboss.webbeans.persistence.spi.JpaServices;
import org.jboss.webbeans.resources.spi.ResourceServices;
+import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Reflections;
@@ -67,9 +63,9 @@
// The constructor
private ConstructorInjectionPoint<T> constructor;
// The post-construct method
- private WBMethod<?> postConstruct;
+ private WBMethod<?, ?> postConstruct;
// The pre-destroy method
- private WBMethod<?> preDestroy;
+ private WBMethod<?, ?> preDestroy;
private Set<WBInjectionPoint<?, ?>> ejbInjectionPoints;
private Set<WBInjectionPoint<?, ?>> persistenceContextInjectionPoints;
@@ -119,24 +115,70 @@
{
originalInjectionPoint = attachCorrectInjectionPoint();
}
- T instance = constructor.newInstance(manager, creationalContext);
+ T instance = produce(creationalContext);
+ inject(instance, creationalContext);
+ postConstruct(instance);
+ if (hasDecorators())
+ {
+ instance = applyDecorators(instance, creationalContext, originalInjectionPoint);
+ }
+ return instance;
+ }
+
+ public T produce(CreationalContext<T> ctx)
+ {
+ T instance = constructor.newInstance(manager, ctx);
if (!hasDecorators())
{
// This should be safe, but needs verification PLM
// Without this, the chaining of decorators will fail as the incomplete instance will be resolved
- creationalContext.push(instance);
+ ctx.push(instance);
}
+ return instance;
+ }
+
+ public void inject(T instance, CreationalContext<T> ctx)
+ {
injectEjbAndCommonFields(instance);
- injectBoundFields(instance, creationalContext);
- callInitializers(instance, creationalContext);
- callPostConstruct(instance);
- if (hasDecorators())
+ injectBoundFields(instance, ctx);
+ callInitializers(instance, ctx);
+ }
+
+ public void postConstruct(T instance)
+ {
+ WBMethod<?, ?> postConstruct = getPostConstruct();
+ if (postConstruct != null)
{
- instance = applyDecorators(instance, creationalContext, originalInjectionPoint);
+ try
+ {
+ postConstruct.invoke(instance);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to invoke " + postConstruct + " on " + instance, e);
+ }
}
- return instance;
}
+
+ public void preDestroy(T instance)
+ {
+ WBMethod<?, ?> preDestroy = getPreDestroy();
+ if (preDestroy != null)
+ {
+ try
+ {
+ // note: RI supports injection into @PreDestroy
+ preDestroy.invoke(instance);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Unable to invoke " + preDestroy + " on " + instance, e);
+ }
+ }
+ }
+
+
protected InjectionPoint attachCorrectInjectionPoint()
{
Decorator<?> decorator = getDecorators().get(getDecorators().size() - 1);
@@ -161,7 +203,7 @@
{
try
{
- callPreDestroy(instance);
+ preDestroy(instance);
creationalContext.release();
}
catch (Exception e)
@@ -170,54 +212,11 @@
}
}
- /**
- * Calls the pre-destroy method, if any
- *
- * @param instance The instance to invoke the method on
- */
- protected void callPreDestroy(T instance)
- {
- WBMethod<?> preDestroy = getPreDestroy();
- if (preDestroy != null)
- {
- try
- {
- // note: RI supports injection into @PreDestroy
- preDestroy.invoke(instance);
- }
- catch (Exception e)
- {
- throw new RuntimeException("Unable to invoke " + preDestroy + " on " + instance, e);
- }
- }
- }
-
- /**
- * Calls the post-construct method, if any
- *
- * @param instance The instance to invoke the method on
- */
- protected void callPostConstruct(T instance)
- {
- WBMethod<?> postConstruct = getPostConstruct();
- if (postConstruct != null)
- {
- try
- {
- postConstruct.invoke(instance);
- }
- catch (Exception e)
- {
- throw new RuntimeException("Unable to invoke " + postConstruct + " on " + instance, e);
- }
- }
- }
-
protected void initEjbInjectionPoints()
{
Class<? extends Annotation> ejbAnnotationType = manager.getServices().get(EJBApiAbstraction.class).EJB_ANNOTATION_CLASS;
this.ejbInjectionPoints = new HashSet<WBInjectionPoint<?, ?>>();
- for (WBField<?> field : annotatedItem.getAnnotatedFields(ejbAnnotationType))
+ for (WBField<?, ?> field : annotatedItem.getAnnotatedWBFields(ejbAnnotationType))
{
this.ejbInjectionPoints.add(FieldInjectionPoint.of(this, field));
}
@@ -229,13 +228,13 @@
this.persistenceUnitInjectionPoints = new HashSet<WBInjectionPoint<?, ?>>();
Class<? extends Annotation> persistenceContextAnnotationType = manager.getServices().get(PersistenceApiAbstraction.class).PERSISTENCE_CONTEXT_ANNOTATION_CLASS;
- for (WBField<?> field : annotatedItem.getAnnotatedFields(persistenceContextAnnotationType))
+ for (WBField<?, ?> field : annotatedItem.getAnnotatedWBFields(persistenceContextAnnotationType))
{
this.persistenceContextInjectionPoints.add(FieldInjectionPoint.of(this, field));
}
Class<? extends Annotation> persistenceUnitAnnotationType = manager.getServices().get(PersistenceApiAbstraction.class).PERSISTENCE_UNIT_ANNOTATION_CLASS;
- for (WBField<?> field : annotatedItem.getAnnotatedFields(persistenceUnitAnnotationType))
+ for (WBField<?, ?> field : annotatedItem.getAnnotatedWBFields(persistenceUnitAnnotationType))
{
this.persistenceUnitInjectionPoints.add(FieldInjectionPoint.of(this, field));
}
@@ -245,7 +244,7 @@
{
Class<? extends Annotation> resourceAnnotationType = manager.getServices().get(EJBApiAbstraction.class).RESOURCE_ANNOTATION_CLASS;
this.resourceInjectionPoints = new HashSet<WBInjectionPoint<?, ?>>();
- for (WBField<?> field : annotatedItem.getAnnotatedFields(resourceAnnotationType))
+ for (WBField<?, ?> field : annotatedItem.getAnnotatedWBFields(resourceAnnotationType))
{
this.resourceInjectionPoints.add(FieldInjectionPoint.of(this, field));
}
@@ -350,9 +349,9 @@
if (decorator instanceof DecoratorBean<?>)
{
DecoratorBean<?> decoratorBean = (DecoratorBean<?>) decorator;
- for (WBMethod<?> decoratorMethod : decoratorBean.getAnnotatedItem().getMethods())
+ for (WBMethod<?, ?> decoratorMethod : decoratorBean.getAnnotatedItem().getWBMethods())
{
- WBMethod<?> method = getAnnotatedItem().getMethod(decoratorMethod.getSignature());
+ WBMethod<?, ?> method = getAnnotatedItem().getWBMethod(decoratorMethod.getSignature());
if (method != null && !method.isStatic() && !method.isPrivate() && method.isFinal())
{
throw new DefinitionException("Decorated bean method " + method + " (decorated by "+ decoratorMethod + ") cannot be declarted final");
@@ -373,7 +372,7 @@
super.checkBeanImplementation();
if (!isDependent())
{
- for (WBField<?> field : getAnnotatedItem().getFields())
+ for (WBField<?, ?> field : getAnnotatedItem().getWBFields())
{
if (field.isPublic() && !field.isStatic())
{
@@ -385,11 +384,11 @@
protected void checkConstructor()
{
- if (!constructor.getAnnotatedParameters(Disposes.class).isEmpty())
+ if (!constructor.getAnnotatedWBParameters(Disposes.class).isEmpty())
{
throw new DefinitionException("Managed bean constructor must not have a parameter annotated @Disposes " + constructor);
}
- if (!constructor.getAnnotatedParameters(Observes.class).isEmpty())
+ if (!constructor.getAnnotatedWBParameters(Observes.class).isEmpty())
{
throw new DefinitionException("Managed bean constructor must not have a parameter annotated @Observes " + constructor);
}
@@ -399,7 +398,7 @@
protected void preSpecialize(BeanDeployerEnvironment environment)
{
super.preSpecialize(environment);
- if (environment.getEjbDescriptors().containsKey(getAnnotatedItem().getSuperclass().getJavaClass()))
+ if (environment.getEjbDescriptors().containsKey(getAnnotatedItem().getWBSuperclass().getJavaClass()))
{
throw new DefinitionException("Simple bean must specialize a simple bean");
}
@@ -408,11 +407,11 @@
@Override
protected void specialize(BeanDeployerEnvironment environment)
{
- if (environment.getClassBean(getAnnotatedItem().getSuperclass()) == null)
+ if (environment.getClassBean(getAnnotatedItem().getWBSuperclass()) == null)
{
throw new DefinitionException(toString() + " does not specialize a bean");
}
- AbstractClassBean<?> specializedBean = environment.getClassBean(getAnnotatedItem().getSuperclass());
+ AbstractClassBean<?> specializedBean = environment.getClassBean(getAnnotatedItem().getWBSuperclass());
if (!(specializedBean instanceof SimpleBean))
{
throw new DefinitionException(toString() + " doesn't have a simple bean as a superclass " + specializedBean);
@@ -429,38 +428,9 @@
*/
protected void initConstructor()
{
- Set<WBConstructor<T>> initializerAnnotatedConstructors = getAnnotatedItem().getAnnotatedConstructors(Initializer.class);
- log.trace("Found " + initializerAnnotatedConstructors + " constructors annotated with @Initializer for " + getType());
- if (initializerAnnotatedConstructors.size() > 1)
- {
- if (initializerAnnotatedConstructors.size() > 1)
- {
- throw new DefinitionException("Cannot have more than one constructor annotated with @Initializer for " + getType());
- }
- }
- else if (initializerAnnotatedConstructors.size() == 1)
- {
- this.constructor = ConstructorInjectionPoint.of(this, initializerAnnotatedConstructors.iterator().next());
- log.trace("Exactly one constructor (" + constructor + ") annotated with @Initializer defined, using it as the bean constructor for " + getType());
- }
- else if (getAnnotatedItem().getNoArgsConstructor() != null)
- {
-
- this.constructor = ConstructorInjectionPoint.of(this, getAnnotatedItem().getNoArgsConstructor());
- log.trace("Exactly one constructor (" + constructor + ") defined, using it as the bean constructor for " + getType());
- }
-
- if (this.constructor == null)
- {
- throw new DefinitionException("Cannot determine constructor to use for " + getType());
- }
- else
- {
- for (WBParameter<?> parameter : constructor.getParameters())
- {
- addInjectionPoint(ParameterInjectionPoint.of(this, parameter));
- }
- }
+ this.constructor = Beans.getBeanConstructor(this, getAnnotatedItem());
+ // TODO We loop unecessarily many times here, I want to probably introduce some callback mechanism. PLM.
+ addInjectionPoints(Beans.getParameterInjectionPoints(this, constructor));
}
/**
@@ -468,21 +438,7 @@
*/
protected void initPostConstruct()
{
- Set<WBMethod<?>> postConstructMethods = getAnnotatedItem().getAnnotatedMethods(PostConstruct.class);
- log.trace("Found " + postConstructMethods + " constructors annotated with @Initializer for " + getType());
- if (postConstructMethods.size() > 1)
- {
- // TODO actually this is wrong, in EJB you can have @PostConstruct
- // methods on the superclass, though the Web Beans spec is silent on
- // the issue
- throw new DefinitionException("Cannot have more than one post construct method annotated with @PostConstruct for " + getType());
- }
- else if (postConstructMethods.size() == 1)
- {
- this.postConstruct = postConstructMethods.iterator().next();
- log.trace("Exactly one post construct method (" + postConstruct + ") for " + getType());
- return;
- }
+ this.postConstruct = Beans.getPostConstruct(getAnnotatedItem());
}
/**
@@ -490,20 +446,7 @@
*/
protected void initPreDestroy()
{
- Set<WBMethod<?>> preDestroyMethods = getAnnotatedItem().getAnnotatedMethods(PreDestroy.class);
- log.trace("Found " + preDestroyMethods + " constructors annotated with @Initializer for " + getType());
- if (preDestroyMethods.size() > 1)
- {
- // TODO actually this is wrong, in EJB you can have @PreDestroy methods
- // on the superclass, though the Web Beans spec is silent on the issue
- throw new DefinitionException("Cannot have more than one pre destroy method annotated with @PreDestroy for " + getType());
- }
- else if (preDestroyMethods.size() == 1)
- {
- this.preDestroy = preDestroyMethods.iterator().next();
- log.trace("Exactly one post construct method (" + preDestroy + ") for " + getType());
- return;
- }
+ this.preDestroy = Beans.getPreDestroy(getAnnotatedItem());
}
/**
@@ -521,7 +464,7 @@
*
* @return The post-construct method
*/
- public WBMethod<?> getPostConstruct()
+ public WBMethod<?, ?> getPostConstruct()
{
return postConstruct;
}
@@ -531,7 +474,7 @@
*
* @return The pre-destroy method
*/
- public WBMethod<?> getPreDestroy()
+ public WBMethod<?, ?> getPreDestroy()
{
return preDestroy;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/DecoratorProxyMethodHandler.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/DecoratorProxyMethodHandler.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/proxy/DecoratorProxyMethodHandler.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -79,7 +79,7 @@
MethodSignature methodSignature = new MethodSignatureImpl(method);
for (SerializableBeanInstance<DecoratorBean<Object>, Object> beanInstance : decoratorInstances)
{
- WBMethod<?> decoratorMethod = beanInstance.getBean().getAnnotatedItem().getMethod(methodSignature);
+ WBMethod<?, ?> decoratorMethod = beanInstance.getBean().getAnnotatedItem().getWBMethod(methodSignature);
if (decoratorMethod != null)
{
return decoratorMethod.invokeOnInstance(beanInstance.getInstance(), args);
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -113,7 +113,7 @@
protected void createProducerMethods(AbstractClassBean<?> declaringBean, WBClass<?> annotatedClass)
{
- for (WBMethod<?> method : annotatedClass.getDeclaredAnnotatedMethods(Produces.class))
+ for (WBMethod<?, ?> method : annotatedClass.getDeclaredWBAnnotatedMethods(Produces.class))
{
createProducerMethod(declaringBean, method);
}
@@ -121,7 +121,7 @@
protected void createDisposalMethods(AbstractClassBean<?> declaringBean, WBClass<?> annotatedClass)
{
- for (WBMethod<?> method : annotatedClass.getDeclaredMethodsWithAnnotatedParameters(Disposes.class))
+ for (WBMethod<?, ?> method : annotatedClass.getWBDeclaredMethodsWithAnnotatedParameters(Disposes.class))
{
DisposalMethodBean<?> disposalBean = DisposalMethodBean.of(manager, method, declaringBean);
disposalBean.initialize(getEnvironment());
@@ -129,13 +129,13 @@
}
}
- protected <T> void createProducerMethod(AbstractClassBean<?> declaringBean, WBMethod<T> annotatedMethod)
+ protected <T> void createProducerMethod(AbstractClassBean<?> declaringBean, WBMethod<T, ?> annotatedMethod)
{
ProducerMethodBean<T> bean = ProducerMethodBean.of(annotatedMethod, declaringBean, manager);
getEnvironment().addBean(bean);
}
- protected <T> void createProducerField(AbstractClassBean<?> declaringBean, WBField<T> field)
+ protected <T> void createProducerField(AbstractClassBean<?> declaringBean, WBField<T, ?> field)
{
ProducerFieldBean<T> bean = ProducerFieldBean.of(field, declaringBean, manager);
getEnvironment().addBean(bean);
@@ -143,7 +143,7 @@
protected void createProducerFields(AbstractClassBean<?> declaringBean, WBClass<?> annotatedClass)
{
- for (WBField<?> field : annotatedClass.getDeclaredAnnotatedFields(Produces.class))
+ for (WBField<?, ?> field : annotatedClass.getDeclaredAnnotatedWBFields(Produces.class))
{
createProducerField(declaringBean, field);
}
@@ -151,13 +151,13 @@
protected void createObserverMethods(RIBean<?> declaringBean, WBClass<?> annotatedClass)
{
- for (WBMethod<?> method : annotatedClass.getDeclaredMethodsWithAnnotatedParameters(Observes.class))
+ for (WBMethod<?, ?> method : annotatedClass.getWBDeclaredMethodsWithAnnotatedParameters(Observes.class))
{
createObserverMethod(declaringBean, method);
}
}
- protected void createObserverMethod(RIBean<?> declaringBean, WBMethod<?> method)
+ protected void createObserverMethod(RIBean<?> declaringBean, WBMethod<?, ?> method)
{
ObserverMethodImpl<?, ?> observer = ObserverFactory.create(method, declaringBean, manager);
getEnvironment().addObserver(observer);
@@ -213,7 +213,7 @@
private static boolean hasSimpleWebBeanConstructor(WBClass<?> type)
{
- return type.getNoArgsConstructor() != null || type.getAnnotatedConstructors(Initializer.class).size() > 0;
+ return type.getNoArgsWBConstructor() != null || type.getAnnotatedWBConstructors(Initializer.class).size() > 0;
}
public BeanDeployerEnvironment getEnvironment()
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -24,7 +24,6 @@
import java.util.Map;
import java.util.Set;
-import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.ObserverMethod;
import org.jboss.webbeans.BeanManagerImpl;
@@ -49,8 +48,8 @@
{
private final Map<WBClass<?>, AbstractClassBean<?>> classBeanMap;
- private final Map<WBMethod<?>, ProducerMethodBean<?>> producerMethodBeanMap;
- private final Map<WBMethod<?>, DisposalMethodBean<?>> disposalMethodBeanMap;
+ private final Map<WBMethod<?, ?>, ProducerMethodBean<?>> producerMethodBeanMap;
+ private final Map<WBMethod<?, ?>, DisposalMethodBean<?>> disposalMethodBeanMap;
private final Set<RIBean<?>> beans;
private final Set<ObserverMethod<?, ?>> observers;
private final List<DisposalMethodBean<?>> allDisposalBeans;
@@ -62,8 +61,8 @@
public BeanDeployerEnvironment(EjbDescriptorCache ejbDescriptors, BeanManagerImpl manager)
{
this.classBeanMap = new HashMap<WBClass<?>, AbstractClassBean<?>>();
- this.producerMethodBeanMap = new HashMap<WBMethod<?>, ProducerMethodBean<?>>();
- this.disposalMethodBeanMap = new HashMap<WBMethod<?>, DisposalMethodBean<?>>();
+ this.producerMethodBeanMap = new HashMap<WBMethod<?, ?>, ProducerMethodBean<?>>();
+ this.disposalMethodBeanMap = new HashMap<WBMethod<?, ?>, DisposalMethodBean<?>>();
this.allDisposalBeans = new ArrayList<DisposalMethodBean<?>>();
this.resolvedDisposalBeans = new HashSet<DisposalMethodBean<?>>();
this.beans = new HashSet<RIBean<?>>();
@@ -73,7 +72,7 @@
this.disposalMethodResolver = new TypeSafeBeanResolver<DisposalMethodBean<?>>(manager, allDisposalBeans);
}
- public ProducerMethodBean<?> getProducerMethod(WBMethod<?> method)
+ public ProducerMethodBean<?> getProducerMethod(WBMethod<?, ?> method)
{
if (!producerMethodBeanMap.containsKey(method))
{
@@ -88,7 +87,7 @@
}
- public DisposalMethodBean<?> getDisposalMethod(WBMethod<?> method)
+ public DisposalMethodBean<?> getDisposalMethod(WBMethod<?, ?> method)
{
if (!producerMethodBeanMap.containsKey(method))
{
@@ -204,12 +203,9 @@
// Correct?
Set<DisposalMethodBean<?>> beans = disposalMethodResolver.resolve(ResolvableFactory.of(annotatedItem));
Set<DisposalMethodBean<T>> disposalBeans = new HashSet<DisposalMethodBean<T>>();
- for (Bean<?> bean : beans)
+ for (DisposalMethodBean<?> bean : beans)
{
- if (bean instanceof DisposalMethodBean<?>)
- {
- disposalBeans.add((DisposalMethodBean<T>) bean);
- }
+ disposalBeans.add((DisposalMethodBean<T>) bean);
}
resolvedDisposalBeans.addAll(disposalBeans);
return Collections.unmodifiableSet(disposalBeans);
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverFactory.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverFactory.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverFactory.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -41,7 +41,7 @@
* @param manager The Web Beans manager
* @return An observer implementation built from the method abstraction
*/
- public static <X, T> ObserverMethodImpl<X, T> create(WBMethod<?> method, RIBean<?> declaringBean, BeanManagerImpl manager)
+ public static <X, T> ObserverMethodImpl<X, T> create(WBMethod<?, ?> method, RIBean<?> declaringBean, BeanManagerImpl manager)
{
ObserverMethodImpl<X, T> result = null;
TransactionPhase transactionPhase = getTransactionalPhase(method);
@@ -63,9 +63,9 @@
* @param observer The observer method
* @return true if the observer method is annotated as transactional
*/
- public static TransactionPhase getTransactionalPhase(WBMethod<?> observer)
+ public static TransactionPhase getTransactionalPhase(WBMethod<?, ?> observer)
{
- WBParameter<?> parameter = observer.getAnnotatedParameters(Observes.class).iterator().next();
+ WBParameter<?, ?> parameter = observer.getAnnotatedWBParameters(Observes.class).iterator().next();
return parameter.getAnnotation(Observes.class).during();
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -43,8 +43,6 @@
import org.jboss.webbeans.injection.MethodInjectionPoint;
import org.jboss.webbeans.introspector.WBMethod;
import org.jboss.webbeans.introspector.WBParameter;
-import org.jboss.webbeans.literal.AnyLiteral;
-import org.jboss.webbeans.util.Names;
/**
* <p>
@@ -65,7 +63,7 @@
protected BeanManagerImpl manager;
private final Notify notifyType;
protected final RIBean<?> observerBean;
- protected final MethodInjectionPoint<?> observerMethod;
+ protected final MethodInjectionPoint<?, ?> observerMethod;
protected TransactionPhase transactionPhase;
/**
@@ -76,7 +74,7 @@
* @param observerBean The observer bean
* @param manager The Web Beans manager
*/
- protected ObserverMethodImpl(final WBMethod<?> observer, final RIBean<?> observerBean, final BeanManagerImpl manager)
+ protected ObserverMethodImpl(final WBMethod<?, ?> observer, final RIBean<?> observerBean, final BeanManagerImpl manager)
{
this.manager = manager;
this.observerBean = observerBean;
@@ -96,7 +94,7 @@
private void checkObserverMethod()
{
// Make sure exactly one and only one parameter is annotated with Observes
- List<WBParameter<?>> eventObjects = this.observerMethod.getAnnotatedParameters(Observes.class);
+ List<WBParameter<?, ?>> eventObjects = this.observerMethod.getAnnotatedParameters(Observes.class);
if (eventObjects.size() > 1)
{
throw new DefinitionException(this + " is invalid because it contains more than event parameter annotated @Observes");
@@ -105,7 +103,7 @@
// variable or wildcard
if (eventObjects.size() > 0)
{
- WBParameter<?> eventParam = eventObjects.iterator().next();
+ WBParameter<?, ?> eventParam = eventObjects.iterator().next();
if (eventParam.isParameterizedType())
{
for (Type type : eventParam.getActualTypeArguments())
@@ -122,7 +120,7 @@
}
}
// Check for parameters annotated with @Disposes
- List<WBParameter<?>> disposeParams = this.observerMethod.getAnnotatedParameters(Disposes.class);
+ List<WBParameter<?, ?>> disposeParams = this.observerMethod.getAnnotatedParameters(Disposes.class);
if (disposeParams.size() > 0)
{
throw new DefinitionException(this + " cannot have any parameters annotated with @Disposes");
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverMethodImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverMethodImpl.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverMethodImpl.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -38,7 +38,7 @@
* @param observerBean The bean declaring the observer method
* @param manager The JCDI manager in use
*/
- protected TransactionalObserverMethodImpl(WBMethod<?> observer, RIBean<?> observerBean, TransactionPhase transactionPhase, BeanManagerImpl manager)
+ protected TransactionalObserverMethodImpl(WBMethod<?, ?> observer, RIBean<?> observerBean, TransactionPhase transactionPhase, BeanManagerImpl manager)
{
super(observer, observerBean, manager);
this.transactionPhase = transactionPhase;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ConstructorInjectionPoint.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -42,15 +42,15 @@
public class ConstructorInjectionPoint<T> extends ForwardingWBConstructor<T> implements WBInjectionPoint<T, Constructor<T>>
{
- private abstract class ForwardingParameterInjectionPointList extends AbstractList<ParameterInjectionPoint<?>>
+ private abstract class ForwardingParameterInjectionPointList extends AbstractList<ParameterInjectionPoint<?, ?>>
{
- protected abstract List<? extends WBParameter<?>> delegate();
+ protected abstract List<? extends WBParameter<?, ?>> delegate();
protected abstract Bean<?> declaringBean();;
@Override
- public ParameterInjectionPoint<?> get(int index)
+ public ParameterInjectionPoint<?, ?> get(int index)
{
return ParameterInjectionPoint.of(declaringBean, delegate().get(index));
}
@@ -101,7 +101,7 @@
{
try
{
- return delegate().newInstance(getParameterValues(getParameters(), null, null, manager, creationalContext));
+ return delegate().newInstance(getParameterValues(getWBParameters(), null, null, manager, creationalContext));
}
catch (IllegalArgumentException e)
{
@@ -123,9 +123,9 @@
}
@Override
- public List<ParameterInjectionPoint<?>> getParameters()
+ public List<ParameterInjectionPoint<?, ?>> getWBParameters()
{
- final List<? extends WBParameter<?>> delegate = super.getParameters();
+ final List<? extends WBParameter<?, ?>> delegate = super.getWBParameters();
return new ForwardingParameterInjectionPointList()
{
@@ -136,10 +136,10 @@
}
@Override
- protected List<? extends WBParameter<?>> delegate()
- {
+ protected List<? extends WBParameter<?, ?>> delegate()
+ {
return delegate;
- }
+ }
};
}
@@ -157,13 +157,13 @@
* @param manager The Web Beans manager
* @return The object array of looked up values
*/
- protected Object[] getParameterValues(List<ParameterInjectionPoint<?>> parameters, Object specialVal, Class<? extends Annotation> specialParam, BeanManagerImpl manager, CreationalContext<?> creationalContext)
+ protected Object[] getParameterValues(List<ParameterInjectionPoint<?, ?>> parameters, Object specialVal, Class<? extends Annotation> specialParam, BeanManagerImpl manager, CreationalContext<?> creationalContext)
{
Object[] parameterValues = new Object[parameters.size()];
- Iterator<ParameterInjectionPoint<?>> iterator = parameters.iterator();
+ Iterator<ParameterInjectionPoint<?, ?>> iterator = parameters.iterator();
for (int i = 0; i < parameterValues.length; i++)
{
- ParameterInjectionPoint<?> param = iterator.next();
+ ParameterInjectionPoint<?, ?> param = iterator.next();
if (specialParam != null && param.isAnnotationPresent(specialParam))
{
parameterValues[i] = specialVal;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/FieldInjectionPoint.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -34,21 +34,21 @@
import org.jboss.webbeans.introspector.ForwardingWBField;
import org.jboss.webbeans.introspector.WBField;
-public class FieldInjectionPoint<T> extends ForwardingWBField<T> implements WBInjectionPoint<T, Field>
+public class FieldInjectionPoint<T, X> extends ForwardingWBField<T, X> implements WBInjectionPoint<T, Field>
{
private static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
private final Bean<?> declaringBean;
- private final WBField<T> field;
+ private final WBField<T, X> field;
private final boolean delegate;
- public static <T> FieldInjectionPoint<T> of(Bean<?> declaringBean, WBField<T> field)
+ public static <T, X> FieldInjectionPoint<T, X> of(Bean<?> declaringBean, WBField<T, X> field)
{
- return new FieldInjectionPoint<T>(declaringBean, field);
+ return new FieldInjectionPoint<T, X>(declaringBean, field);
}
- protected FieldInjectionPoint(Bean<?> declaringBean, WBField<T> field)
+ protected FieldInjectionPoint(Bean<?> declaringBean, WBField<T, X> field)
{
this.declaringBean = declaringBean;
this.field = field;
@@ -56,7 +56,7 @@
}
@Override
- protected WBField<T> delegate()
+ protected WBField<T, X> delegate()
{
return field;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/MethodInjectionPoint.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -39,18 +39,18 @@
import org.jboss.webbeans.introspector.WBMethod;
import org.jboss.webbeans.introspector.WBParameter;
-public class MethodInjectionPoint<T> extends ForwardingWBMethod<T> implements WBInjectionPoint<T, Method>
+public class MethodInjectionPoint<T, X> extends ForwardingWBMethod<T, X> implements WBInjectionPoint<T, Method>
{
- private abstract class ForwardingParameterInjectionPointList extends AbstractList<ParameterInjectionPoint<?>>
+ private abstract class ForwardingParameterInjectionPointList extends AbstractList<ParameterInjectionPoint<?, ?>>
{
- protected abstract List<? extends WBParameter<?>> delegate();
+ protected abstract List<? extends WBParameter<?, ?>> delegate();
protected abstract Bean<?> declaringBean();;
@Override
- public ParameterInjectionPoint<?> get(int index)
+ public ParameterInjectionPoint<?, ?> get(int index)
{
return ParameterInjectionPoint.of(declaringBean, delegate().get(index));
}
@@ -66,15 +66,15 @@
private static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
private final Bean<?> declaringBean;
- private final WBMethod<T> method;
+ private final WBMethod<T, X> method;
private final boolean delegate;
- public static <T> MethodInjectionPoint<T> of(Bean<?> declaringBean, WBMethod<T> method)
+ public static <T, X> MethodInjectionPoint<T, X> of(Bean<?> declaringBean, WBMethod<T, X> method)
{
- return new MethodInjectionPoint<T>(declaringBean, method);
+ return new MethodInjectionPoint<T, X>(declaringBean, method);
}
- protected MethodInjectionPoint(Bean<?> declaringBean, WBMethod<T> method)
+ protected MethodInjectionPoint(Bean<?> declaringBean, WBMethod<T, X> method)
{
this.declaringBean = declaringBean;
this.method = method;
@@ -82,7 +82,7 @@
}
@Override
- protected WBMethod<T> delegate()
+ protected WBMethod<T, X> delegate()
{
return method;
}
@@ -101,7 +101,7 @@
{
try
{
- return delegate().invoke(declaringInstance, getParameterValues(getParameters(), null, null, manager, creationalContext));
+ return delegate().invoke(declaringInstance, getParameterValues(getWBParameters(), null, null, manager, creationalContext));
}
catch (IllegalArgumentException e)
{
@@ -123,7 +123,7 @@
{
try
{
- return invoke(declaringInstance, getParameterValues(getParameters(), annotatedParameter, parameter, manager, creationalContext));
+ return invoke(declaringInstance, getParameterValues(getWBParameters(), annotatedParameter, parameter, manager, creationalContext));
}
catch (IllegalArgumentException e)
{
@@ -144,7 +144,7 @@
{
try
{
- return delegate().invokeOnInstance(declaringInstance, getParameterValues(getParameters(), null, null, manager, creationalContext));
+ return delegate().invokeOnInstance(declaringInstance, getParameterValues(getWBParameters(), null, null, manager, creationalContext));
}
catch (IllegalArgumentException e)
{
@@ -174,7 +174,7 @@
{
try
{
- return invokeOnInstance(declaringInstance, getParameterValues(getParameters(), annotatedParameter, parameter, manager, creationalContext));
+ return invokeOnInstance(declaringInstance, getParameterValues(getWBParameters(), annotatedParameter, parameter, manager, creationalContext));
}
catch (IllegalArgumentException e)
{
@@ -200,9 +200,9 @@
}
@Override
- public List<ParameterInjectionPoint<?>> getParameters()
+ public List<ParameterInjectionPoint<?, ?>> getWBParameters()
{
- final List<? extends WBParameter<?>> delegate = super.getParameters();
+ final List<? extends WBParameter<?, ?>> delegate = super.getWBParameters();
return new ForwardingParameterInjectionPointList()
{
@@ -213,10 +213,10 @@
}
@Override
- protected List<? extends WBParameter<?>> delegate()
- {
+ protected List<? extends WBParameter<?, ?>> delegate()
+ {
return delegate;
- }
+ }
};
}
@@ -249,13 +249,13 @@
* @param manager The Web Beans manager
* @return The object array of looked up values
*/
- protected Object[] getParameterValues(List<ParameterInjectionPoint<?>> parameters, Class<? extends Annotation> specialParam, Object specialVal, BeanManagerImpl manager, CreationalContext<?> creationalContext)
+ protected Object[] getParameterValues(List<ParameterInjectionPoint<?, ?>> parameters, Class<? extends Annotation> specialParam, Object specialVal, BeanManagerImpl manager, CreationalContext<?> creationalContext)
{
Object[] parameterValues = new Object[parameters.size()];
- Iterator<ParameterInjectionPoint<?>> iterator = parameters.iterator();
+ Iterator<ParameterInjectionPoint<?, ?>> iterator = parameters.iterator();
for (int i = 0; i < parameterValues.length; i++)
{
- ParameterInjectionPoint<?> param = iterator.next();
+ ParameterInjectionPoint<?, ?> param = iterator.next();
if (specialParam != null && param.isAnnotationPresent(specialParam))
{
parameterValues[i] = specialVal;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ParameterInjectionPoint.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -31,21 +31,21 @@
import org.jboss.webbeans.introspector.ForwardingWBParameter;
import org.jboss.webbeans.introspector.WBParameter;
-public class ParameterInjectionPoint<T> extends ForwardingWBParameter<T> implements WBInjectionPoint<T, Object>
+public class ParameterInjectionPoint<T, X> extends ForwardingWBParameter<T, X> implements WBInjectionPoint<T, Object>
{
private static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
- public static <T> ParameterInjectionPoint<T> of(Bean<?> declaringBean, WBParameter<T> parameter)
+ public static <T, X> ParameterInjectionPoint<T, X> of(Bean<?> declaringBean, WBParameter<T, X> parameter)
{
- return new ParameterInjectionPoint<T>(declaringBean, parameter);
+ return new ParameterInjectionPoint<T, X>(declaringBean, parameter);
}
private final Bean<?> declaringBean;
- private final WBParameter<T> parameter;
+ private final WBParameter<T, X> parameter;
private final boolean delegate;
- private ParameterInjectionPoint(Bean<?> declaringBean, WBParameter<T> parameter)
+ private ParameterInjectionPoint(Bean<?> declaringBean, WBParameter<T, X> parameter)
{
this.declaringBean = declaringBean;
this.parameter = parameter;
@@ -53,7 +53,7 @@
}
@Override
- protected WBParameter<T> delegate()
+ protected WBParameter<T, X> delegate()
{
return parameter;
}
@@ -70,7 +70,7 @@
public Member getJavaMember()
{
- return delegate().getDeclaringMember().getJavaMember();
+ return delegate().getDeclaringCallable().getJavaMember();
}
public void inject(Object declaringInstance, Object value)
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBAnnotation.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBAnnotation.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBAnnotation.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -19,18 +19,18 @@
import java.lang.annotation.Annotation;
import java.util.Set;
-public abstract class ForwardingWBAnnotation<T extends Annotation> extends ForwardingWBType<T> implements WBAnnotation<T>
+public abstract class ForwardingWBAnnotation<T extends Annotation> extends ForwardingWBClass<T> implements WBAnnotation<T>
{
@Override
protected abstract WBAnnotation<T> delegate();
- public Set<WBMethod<?>> getAnnotatedMembers(Class<? extends Annotation> annotationType)
+ public Set<WBMethod<?, ?>> getAnnotatedMembers(Class<? extends Annotation> annotationType)
{
return delegate().getAnnotatedMembers(annotationType);
}
- public Set<WBMethod<?>> getMembers()
+ public Set<WBMethod<?, ?>> getMembers()
{
return delegate().getMembers();
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -20,90 +20,90 @@
import java.lang.reflect.Method;
import java.util.Set;
-public abstract class ForwardingWBClass<T> extends ForwardingWBType<T> implements WBClass<T>
+public abstract class ForwardingWBClass<T> extends ForwardingWBAnnotated<T, Class<T>> implements WBClass<T>
{
protected abstract WBClass<T> delegate();
- public Set<WBConstructor<T>> getAnnotatedConstructors(Class<? extends Annotation> annotationType)
+ public Set<WBConstructor<T>> getAnnotatedWBConstructors(Class<? extends Annotation> annotationType)
{
- return delegate().getAnnotatedConstructors(annotationType);
+ return delegate().getAnnotatedWBConstructors(annotationType);
}
- public Set<WBField<?>> getAnnotatedFields(Class<? extends Annotation> annotationType)
+ public Set<WBField<?, ?>> getAnnotatedWBFields(Class<? extends Annotation> annotationType)
{
- return delegate().getAnnotatedFields(annotationType);
+ return delegate().getAnnotatedWBFields(annotationType);
}
- public Set<WBMethod<?>> getAnnotatedMethods(Class<? extends Annotation> annotationType)
+ public Set<WBMethod<?, ?>> getAnnotatedWBMethods(Class<? extends Annotation> annotationType)
{
- return delegate().getAnnotatedMethods(annotationType);
+ return delegate().getAnnotatedWBMethods(annotationType);
}
- public WBConstructor<T> getNoArgsConstructor()
+ public WBConstructor<T> getNoArgsWBConstructor()
{
- return delegate().getNoArgsConstructor();
+ return delegate().getNoArgsWBConstructor();
}
- public Set<WBConstructor<T>> getConstructors()
+ public Set<WBConstructor<T>> getWBConstructors()
{
- return delegate().getConstructors();
+ return delegate().getWBConstructors();
}
- public Set<WBMethod<?>> getMethods()
+ public Set<WBMethod<?, ?>> getWBMethods()
{
- return delegate().getMethods();
+ return delegate().getWBMethods();
}
- public Set<WBField<?>> getDeclaredAnnotatedFields(Class<? extends Annotation> annotationType)
+ public Set<WBField<?, ?>> getDeclaredAnnotatedWBFields(Class<? extends Annotation> annotationType)
{
- return delegate().getDeclaredAnnotatedFields(annotationType);
+ return delegate().getDeclaredAnnotatedWBFields(annotationType);
}
- public Set<WBMethod<?>> getDeclaredAnnotatedMethods(Class<? extends Annotation> annotationType)
+ public Set<WBMethod<?, ?>> getDeclaredWBAnnotatedMethods(Class<? extends Annotation> annotationType)
{
- return delegate().getDeclaredAnnotatedMethods(annotationType);
+ return delegate().getDeclaredWBAnnotatedMethods(annotationType);
}
- public Set<WBMethod<?>> getDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
+ public Set<WBMethod<?, ?>> getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
{
- return delegate().getDeclaredMethodsWithAnnotatedParameters(annotationType);
+ return delegate().getWBDeclaredMethodsWithAnnotatedParameters(annotationType);
}
- public Set<WBField<?>> getFields()
+ public Set<WBField<?, ?>> getWBFields()
{
- return delegate().getFields();
+ return delegate().getWBFields();
}
- public Set<WBField<?>> getMetaAnnotatedFields(Class<? extends Annotation> metaAnnotationType)
+ public Set<WBField<?, ?>> getMetaAnnotatedWBFields(Class<? extends Annotation> metaAnnotationType)
{
- return delegate().getMetaAnnotatedFields(metaAnnotationType);
+ return delegate().getMetaAnnotatedWBFields(metaAnnotationType);
}
@Deprecated
- public WBMethod<?> getMethod(Method method)
+ public WBMethod<?, ?> getWBMethod(Method method)
{
- return delegate().getMethod(method);
+ return delegate().getWBMethod(method);
}
- public <M> WBMethod<M> getMethod(MethodSignature signature)
+ public <M> WBMethod<M, ?> getWBMethod(MethodSignature signature)
{
- return delegate().getMethod(signature);
+ return delegate().getWBMethod(signature);
}
- public Set<WBMethod<?>> getMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
+ public Set<WBMethod<?, ?>> getWBMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
{
- return delegate().getMethodsWithAnnotatedParameters(annotationType);
+ return delegate().getWBMethodsWithAnnotatedParameters(annotationType);
}
- public Set<WBConstructor<?>> getConstructorsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
+ public Set<WBConstructor<?>> getWBConstructorsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
{
- return delegate().getConstructorsWithAnnotatedParameters(annotationType);
+ return delegate().getWBConstructorsWithAnnotatedParameters(annotationType);
}
- public WBClass<?> getSuperclass()
+ public WBClass<?> getWBSuperclass()
{
- return delegate().getSuperclass();
+ return delegate().getWBSuperclass();
}
public boolean isNonStaticMemberClass()
@@ -127,29 +127,29 @@
}
@Deprecated
- public WBMethod<?> getDeclaredMethod(Method method)
+ public WBMethod<?, ?> getDeclaredWBMethod(Method method)
{
- return delegate().getDeclaredMethod(method);
+ return delegate().getDeclaredWBMethod(method);
}
- public <F> WBField<F> getDeclaredField(String fieldName, WBClass<F> expectedType)
+ public <F> WBField<F, ?> getDeclaredWBField(String fieldName, WBClass<F> expectedType)
{
- return delegate().getDeclaredField(fieldName, expectedType);
+ return delegate().getDeclaredWBField(fieldName, expectedType);
}
- public <M> WBMethod<M> getDeclaredMethod(MethodSignature signature, WBClass<M> expectedReturnType)
+ public <M> WBMethod<M, ?> getDeclaredWBMethod(MethodSignature signature, WBClass<M> expectedReturnType)
{
- return delegate().getDeclaredMethod(signature, expectedReturnType);
+ return delegate().getDeclaredWBMethod(signature, expectedReturnType);
}
- public WBConstructor<T> getDeclaredConstructor(ConstructorSignature signature)
+ public WBConstructor<T> getDeclaredWBConstructor(ConstructorSignature signature)
{
- return delegate().getDeclaredConstructor(signature);
+ return delegate().getDeclaredWBConstructor(signature);
}
- public <U> WBClass<? extends U> asSubclass(WBClass<U> clazz)
+ public <U> WBClass<? extends U> asWBSubclass(WBClass<U> clazz)
{
- return delegate().asSubclass(clazz);
+ return delegate().asWBSubclass(clazz);
}
public <S> S cast(Object object)
@@ -157,6 +157,14 @@
return delegate().<S>cast(object);
}
+ public boolean isEquivalent(Class<?> clazz)
+ {
+ return delegate().isEquivalent(clazz);
+ }
+ public String getSimpleName()
+ {
+ return delegate().getSimpleName();
+ }
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBConstructor.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBConstructor.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBConstructor.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -21,25 +21,27 @@
import java.lang.reflect.InvocationTargetException;
import java.util.List;
-public abstract class ForwardingWBConstructor<T> extends ForwardingWBMember<T, Constructor<T>> implements WBConstructor<T>
+import javax.enterprise.inject.spi.AnnotatedParameter;
+
+public abstract class ForwardingWBConstructor<T> extends ForwardingWBMember<T, T, Constructor<T>> implements WBConstructor<T>
{
@Override
protected abstract WBConstructor<T> delegate();
- public List<WBParameter<?>> getAnnotatedParameters(Class<? extends Annotation> annotationType)
+ public List<WBParameter<?, ?>> getAnnotatedWBParameters(Class<? extends Annotation> annotationType)
{
- return delegate().getAnnotatedParameters(annotationType);
+ return delegate().getAnnotatedWBParameters(annotationType);
}
- public WBType<T> getDeclaringType()
+ public WBClass<T> getDeclaringType()
{
return delegate().getDeclaringType();
}
- public List<? extends WBParameter<?>> getParameters()
+ public List<? extends WBParameter<?, ?>> getWBParameters()
{
- return delegate().getParameters();
+ return delegate().getWBParameters();
}
public T newInstance(Object... parameters) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException
@@ -52,5 +54,9 @@
return delegate().getSignature();
}
+ public List<AnnotatedParameter<T>> getParameters()
+ {
+ return delegate().getParameters();
+ }
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBField.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBField.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBField.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -18,18 +18,18 @@
import java.lang.reflect.Field;
-public abstract class ForwardingWBField<T> extends ForwardingWBMember<T, Field> implements WBField<T>
+public abstract class ForwardingWBField<T, X> extends ForwardingWBMember<T, X, Field> implements WBField<T, X>
{
@Override
- protected abstract WBField<T> delegate();
+ protected abstract WBField<T, X> delegate();
public T get(Object instance)
{
return delegate().get(instance);
}
- public WBType<?> getDeclaringType()
+ public WBClass<X> getDeclaringType()
{
return delegate().getDeclaringType();
}
@@ -47,6 +47,6 @@
public boolean isTransient()
{
return delegate().isTransient();
- }
+ }
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBMember.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBMember.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBMember.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -18,15 +18,20 @@
import java.lang.reflect.Member;
-public abstract class ForwardingWBMember<T, S extends Member> extends ForwardingWBAnnotated<T, S> implements WBMember<T, S>
+public abstract class ForwardingWBMember<T, X, S extends Member> extends ForwardingWBAnnotated<T, S> implements WBMember<T, X, S>
{
@Override
- protected abstract WBMember<T, S> delegate();
+ protected abstract WBMember<T, X, S> delegate();
public S getJavaMember()
{
return delegate().getJavaMember();
}
+
+ public WBClass<X> getDeclaringType()
+ {
+ return delegate().getDeclaringType();
+ }
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBMethod.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBMethod.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBMethod.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -21,37 +21,34 @@
import java.lang.reflect.Method;
import java.util.List;
-public abstract class ForwardingWBMethod<T> extends ForwardingWBMember<T, Method> implements WBMethod<T>
+import javax.enterprise.inject.spi.AnnotatedParameter;
+
+public abstract class ForwardingWBMethod<T, X> extends ForwardingWBMember<T,X, Method> implements WBMethod<T, X>
{
@Override
- protected abstract WBMethod<T> delegate();
+ protected abstract WBMethod<T, X> delegate();
public Method getAnnotatedMethod()
{
return delegate().getAnnotatedMethod();
}
- public List<WBParameter<?>> getAnnotatedParameters(Class<? extends Annotation> metaAnnotationType)
+ public List<WBParameter<?, ?>> getAnnotatedParameters(Class<? extends Annotation> metaAnnotationType)
{
- return delegate().getAnnotatedParameters(metaAnnotationType);
+ return delegate().getAnnotatedWBParameters(metaAnnotationType);
}
- public WBType<?> getDeclaringType()
+ public Class<?>[] getParameterTypesAsArray()
{
- return delegate().getDeclaringType();
+ return delegate().getParameterTypesAsArray();
}
- public Class<?>[] getParameterTypesAsArray()
+ public List<? extends WBParameter<?, ?>> getWBParameters()
{
- return delegate().getParameterTypesAsArray();
+ return delegate().getWBParameters();
}
- public List<? extends WBParameter<?>> getParameters()
- {
- return delegate().getParameters();
- }
-
public String getPropertyName()
{
return delegate().getPropertyName();
@@ -77,4 +74,14 @@
return delegate().getSignature();
}
+ public List<WBParameter<?, ?>> getAnnotatedWBParameters(Class<? extends Annotation> metaAnnotationType)
+ {
+ return delegate().getAnnotatedWBParameters(metaAnnotationType);
+ }
+
+ public List<AnnotatedParameter<X>> getParameters()
+ {
+ return delegate().getParameters();
+ }
+
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBParameter.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBParameter.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBParameter.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -16,17 +16,23 @@
*/
package org.jboss.webbeans.introspector;
+import javax.enterprise.inject.spi.AnnotatedCallable;
-public abstract class ForwardingWBParameter<T> extends ForwardingWBAnnotated<T, Object> implements WBParameter<T>
+
+public abstract class ForwardingWBParameter<T, X> extends ForwardingWBAnnotated<T, Object> implements WBParameter<T, X>
{
@Override
- protected abstract WBParameter<T> delegate();
+ protected abstract WBParameter<T, X> delegate();
- public WBMember<?, ?> getDeclaringMember()
+ public AnnotatedCallable<X> getDeclaringCallable()
{
- return delegate().getDeclaringMember();
+ return delegate().getDeclaringCallable();
}
+ public int getPosition()
+ {
+ return delegate().getPosition();
+ }
}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBType.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBType.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBType.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.introspector;
-
-public abstract class ForwardingWBType<T> extends ForwardingWBAnnotated<T, Class<T>> implements WBType<T>
-{
-
- @Override
- protected abstract WBType<T> delegate();
-
- public WBType<?> getSuperclass()
- {
- return delegate().getSuperclass();
- }
-
- public boolean isEquivalent(Class<?> clazz)
- {
- return delegate().isEquivalent(clazz);
- }
-
- public String getSimpleName()
- {
- return delegate().getSimpleName();
- }
-
-}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBAnnotation.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBAnnotation.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBAnnotation.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -25,14 +25,14 @@
* @author Pete Muir
*
*/
-public interface WBAnnotation<T extends Annotation> extends WBType<T>
+public interface WBAnnotation<T extends Annotation> extends WBClass<T>
{
/**
* Gets all members
*
* @return A set of abstracted members
*/
- public Set<WBMethod<?>> getMembers();
+ public Set<WBMethod<?, ?>> getMembers();
/**
* Gets all the members annotated with annotationType
@@ -40,7 +40,7 @@
* @param annotationType The annotation type to match
* @return A set of abstracted members with the annotation type
*/
- public Set<WBMethod<?>> getAnnotatedMembers(Class<? extends Annotation> annotationType);
+ public Set<WBMethod<?, ?>> getAnnotatedMembers(Class<? extends Annotation> annotationType);
/**
* Get an annotation member by name
@@ -48,8 +48,6 @@
* @param memberName
* @return
*/
- public <A> WBMethod<A> getMember(String memberName, WBClass<A> expectedType);
+ public <A> WBMethod<A, ?> getMember(String memberName, WBClass<A> expectedType);
- public Class<T> getJavaClass();
-
}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBCallable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBCallable.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBCallable.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.introspector;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.util.List;
+
+import javax.enterprise.inject.spi.AnnotatedCallable;
+
+/**
+ * @author pmuir
+ *
+ */
+public interface WBCallable<T, X, S extends Member> extends WBMember<T, X, S>, AnnotatedCallable<X>
+{
+
+ /**
+ * Gets the abstracted parameters of the method
+ *
+ * @return A list of parameters. Returns an empty list if no parameters are
+ * present.
+ */
+ public List<? extends WBParameter<?, ?>> getWBParameters();
+
+ /**
+ * Gets the list of annotated parameters for a given annotation
+ *
+ * @param metaAnnotationType The annotation to match
+ * @return A set of matching parameter abstractions. Returns an empty list if
+ * there are no matches.
+ */
+ public List<WBParameter<?, ?>> getAnnotatedWBParameters(Class<? extends Annotation> metaAnnotationType);
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBCallable.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -20,13 +20,15 @@
import java.lang.reflect.Method;
import java.util.Set;
+import javax.enterprise.inject.spi.AnnotatedType;
+
/**
* Represents a Class
*
* @author Pete Muir
*
*/
-public interface WBClass<T> extends WBType<T>
+public interface WBClass<T> extends WBAnnotated<T, Class<T>>, AnnotatedType<T>
{
/**
@@ -34,14 +36,14 @@
*
* @return A set of abstracted fields
*/
- public Set<WBField<?>> getFields();
+ public Set<WBField<?, ?>> getWBFields();
/**
* Gets all fields on the type
*
* @return A set of abstracted fields
*/
- public Set<WBMethod<?>> getMethods();
+ public Set<WBMethod<?, ?>> getWBMethods();
/**
* Get a field by name
@@ -51,7 +53,7 @@
* @param expectedType the expected type of the field
* @return the field
*/
- public <F> WBField<F> getDeclaredField(String fieldName, WBClass<F> expectedType);
+ public <F> WBField<F, ?> getDeclaredWBField(String fieldName, WBClass<F> expectedType);
/**
* Gets all fields which are annotated with the given annotation type on this
@@ -61,7 +63,7 @@
* @return A set of abstracted fields with the given annotation. Returns an
* empty set if there are no matches
*/
- public Set<WBField<?>> getAnnotatedFields(Class<? extends Annotation> annotationType);
+ public Set<WBField<?, ?>> getAnnotatedWBFields(Class<? extends Annotation> annotationType);
/**
* Gets all fields which are annotated with the given annotation type on this
@@ -71,7 +73,7 @@
* @return A set of abstracted fields with the given annotation. Returns an
* empty set if there are no matches
*/
- public Set<WBField<?>> getDeclaredAnnotatedFields(Class<? extends Annotation> annotationType);
+ public Set<WBField<?, ?>> getDeclaredAnnotatedWBFields(Class<? extends Annotation> annotationType);
/**
* Gets all fields which are meta-annotated with metaAnnotationType
@@ -80,7 +82,7 @@
* @return A set of abstracted fields with the given meta-annotation. Returns
* an empty set if there are no matches
*/
- public Set<WBField<?>> getMetaAnnotatedFields(Class<? extends Annotation> metaAnnotationType);
+ public Set<WBField<?, ?>> getMetaAnnotatedWBFields(Class<? extends Annotation> metaAnnotationType);
/**
* Gets all constructors which are annotated with annotationType
@@ -89,21 +91,21 @@
* @return A set of abstracted fields with the given annotation. Returns an
* empty set if there are no matches
*/
- public Set<WBConstructor<T>> getAnnotatedConstructors(Class<? extends Annotation> annotationType);
+ public Set<WBConstructor<T>> getAnnotatedWBConstructors(Class<? extends Annotation> annotationType);
/**
* Gets all constructors
*
* @return A set of abstracted constructors
*/
- public Set<WBConstructor<T>> getConstructors();
+ public Set<WBConstructor<T>> getWBConstructors();
/**
* Gets the no-args constructor
*
* @return The no-args constructor, or null if not defined
*/
- public WBConstructor<T> getNoArgsConstructor();
+ public WBConstructor<T> getNoArgsWBConstructor();
/**
* Get the constructor which matches the argument list provided
@@ -111,7 +113,7 @@
* @param parameterTypes the parameters of the constructor
* @return the matching constructor, or null if not defined
*/
- public WBConstructor<T> getDeclaredConstructor(ConstructorSignature signature);
+ public WBConstructor<T> getDeclaredWBConstructor(ConstructorSignature signature);
/**
* Gets all methods annotated with annotationType
@@ -120,7 +122,7 @@
* @return A set of abstracted methods with the given annotation. Returns an
* empty set if there are no matches
*/
- public Set<WBMethod<?>> getAnnotatedMethods(Class<? extends Annotation> annotationType);
+ public Set<WBMethod<?, ?>> getAnnotatedWBMethods(Class<? extends Annotation> annotationType);
/**
* Gets all methods annotated with annotationType
@@ -129,7 +131,7 @@
* @return A set of abstracted methods with the given annotation. Returns an
* empty set if there are no matches
*/
- public Set<WBMethod<?>> getDeclaredAnnotatedMethods(Class<? extends Annotation> annotationType);
+ public Set<WBMethod<?, ?>> getDeclaredWBAnnotatedMethods(Class<? extends Annotation> annotationType);
/**
* Find the annotated method for a given methodDescriptor
@@ -137,10 +139,8 @@
* @param methodDescriptor
* @return
*
- * TODO Replace with AnnotatedMethod variant
*/
- @Deprecated
- public WBMethod<?> getMethod(Method method);
+ public WBMethod<?, ?> getWBMethod(Method method);
/**
* Get a method by name
@@ -150,7 +150,7 @@
* @param expectedReturnType the expected return type
* @return the method, or null if it doesn't exist
*/
- public <M> WBMethod<M> getDeclaredMethod(MethodSignature signature, WBClass<M> expectedReturnType);
+ public <M> WBMethod<M, ?> getDeclaredWBMethod(MethodSignature signature, WBClass<M> expectedReturnType);
/**
* Get a method by name
@@ -159,11 +159,11 @@
* @param signature the name of the method
* @return the method, or null if it doesn't exist
*/
- public <M> WBMethod<M> getMethod(MethodSignature signature);
+ public <M> WBMethod<M, ?> getWBMethod(MethodSignature signature);
// TODO Replace with AnnotatedMethod variant
@Deprecated
- public WBMethod<?> getDeclaredMethod(Method method);
+ public WBMethod<?, ?> getDeclaredWBMethod(Method method);
/**
* Gets all with parameters annotated with annotationType
@@ -172,7 +172,7 @@
* @return A set of abstracted methods with the given annotation. Returns an
* empty set if there are no matches
*/
- public Set<WBMethod<?>> getMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType);
+ public Set<WBMethod<?, ?>> getWBMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType);
/**
* Gets all with constructors annotated with annotationType
@@ -181,7 +181,7 @@
* @return A set of abstracted constructors with the given annotation. Returns an
* empty set if there are no matches
*/
- public Set<WBConstructor<?>> getConstructorsWithAnnotatedParameters(Class<? extends Annotation> annotationType);
+ public Set<WBConstructor<?>> getWBConstructorsWithAnnotatedParameters(Class<? extends Annotation> annotationType);
/**
* Gets all with parameters annotated with annotationType
@@ -190,14 +190,14 @@
* @return A set of abstracted methods with the given annotation. Returns an
* empty set if there are no matches
*/
- public Set<WBMethod<?>> getDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType);
+ public Set<WBMethod<?, ?>> getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType);
/**
* Gets the superclass.
*
* @return The abstracted superclass, null if there is no superclass
*/
- public WBClass<?> getSuperclass();
+ public WBClass<?> getWBSuperclass();
/**
* Determine if this is a non-static member class
@@ -214,6 +214,15 @@
public <S> S cast(Object object);
- public <U> WBClass<? extends U> asSubclass(WBClass<U> clazz);
+ public <U> WBClass<? extends U> asWBSubclass(WBClass<U> clazz);
+ /**
+ * Check if this is equivalent to a java class
+ * @param clazz The Java class
+ * @return true if equivalent
+ */
+ public boolean isEquivalent(Class<?> clazz);
+
+ public String getSimpleName();
+
}
\ No newline at end of file
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBConstructor.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBConstructor.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBConstructor.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -21,10 +21,10 @@
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import javax.decorator.Decorates;
+import javax.enterprise.inject.spi.AnnotatedConstructor;
/**
* Represents a Class Constructor
@@ -32,44 +32,19 @@
* @author Pete Muir
*
*/
-public interface WBConstructor<T> extends WBMember<T, Constructor<T>>
+public interface WBConstructor<T> extends WBCallable<T, T, Constructor<T>>, AnnotatedConstructor<T>
{
@SuppressWarnings("unchecked")
public static final Set<Class<? extends Annotation>> MAPPED_PARAMETER_ANNOTATIONS = new HashSet<Class<? extends Annotation>>(Arrays.asList(Decorates.class));
/**
- * Gets all parameters to the constructor
- *
- * @return A set of abstracted parameters. Returns an empty set if there are
- * no parameters
- */
- public List<? extends WBParameter<?>> getParameters();
-
- /**
- * Gets all parameters to the constructor which are annotated with
- * annotationType
- *
- * @param annotationType A annotation to match
- * @return A list of abstracted parameters with the given annotation type.
- * Returns an empty set if there are no matches.
- */
- public List<WBParameter<?>> getAnnotatedParameters(Class<? extends Annotation> annotationType);
-
- /**
* Creates a new instance of the class, using this constructor
*
* @return The created instance
*/
public T newInstance(Object... parameters) throws IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException;
- /**
- * Gets the declaring class of the annotation
- *
- * @return An abstraction of the declaring class
- */
- public WBType<T> getDeclaringType();
-
public ConstructorSignature getSignature();
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBField.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBField.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBField.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -18,6 +18,8 @@
import java.lang.reflect.Field;
+import javax.enterprise.inject.spi.AnnotatedField;
+
/**
* AnnotatedField provides a uniform access to the annotations on an annotated
* field
@@ -25,7 +27,7 @@
* @author Pete Muir
*
*/
-public interface WBField<T> extends WBMember<T, Field>
+public interface WBField<T, X> extends WBMember<T, X, Field>, AnnotatedField<X>
{
/**
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBMember.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBMember.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBMember.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -17,13 +17,15 @@
package org.jboss.webbeans.introspector;
import java.lang.reflect.Member;
+
+import javax.enterprise.inject.spi.AnnotatedMember;
/**
* AnnotedMember provides enhanced access to an annotated member
*
* @author Pete Muir
*
*/
-public interface WBMember<T, S extends Member> extends WBAnnotated<T, S>
+public interface WBMember<T, X, S extends Member> extends WBAnnotated<T, S>, AnnotatedMember<X>
{
public S getJavaMember();
@@ -33,6 +35,6 @@
*
* @return The declaring class
*/
- public WBType<?> getDeclaringType();
+ public WBClass<X> getDeclaringType();
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBMethod.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBMethod.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBMethod.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -21,11 +21,11 @@
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.spi.AnnotatedMethod;
/**
* AnnotatedType provides a uniform access to the annotations on an annotated
@@ -34,33 +34,16 @@
* @author Pete Muir
*
*/
-public interface WBMethod<T> extends WBMember<T, Method>
+public interface WBMethod<T, X> extends WBCallable<T, X, Method>, AnnotatedMethod<X>
{
@SuppressWarnings("unchecked")
public static final Set<Class<? extends Annotation>> MAPPED_PARAMETER_ANNOTATIONS = new HashSet<Class<? extends Annotation>>(Arrays.asList(Disposes.class, Observes.class, Disposes.class));
/**
- * Gets the abstracted parameters of the method
- *
- * @return A list of parameters. Returns an empty list if no parameters are
- * present.
- */
- public List<? extends WBParameter<?>> getParameters();
-
- /**
- * Gets the list of annotated parameters for a given annotation
- *
- * @param metaAnnotationType The annotation to match
- * @return A set of matching parameter abstractions. Returns an empty list if
- * there are no matches.
- */
- public List<WBParameter<?>> getAnnotatedParameters(Class<? extends Annotation> metaAnnotationType);
-
- /**
* Get the parameter types as an array
*/
public Class<?>[] getParameterTypesAsArray();
-
+
/**
* Invokes the method
*
@@ -81,13 +64,6 @@
public T invokeOnInstance(Object instance, Object... parameters) throws IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException;
/**
- * Gets the declaring class
- *
- * @return An abstraction of the declaring class
- */
- public WBType<?> getDeclaringType();
-
- /**
* Gets the property name
*
* @return The name
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBParameter.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBParameter.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBParameter.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -16,6 +16,8 @@
*/
package org.jboss.webbeans.introspector;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+
/**
* AnnotatedParameter provides a uniform access to a method parameter defined
* either in Java or XML
@@ -23,9 +25,7 @@
* @author Pete Muir
* @param <T>
*/
-public interface WBParameter<T> extends WBAnnotated<T, Object>
+public interface WBParameter<T, X> extends WBAnnotated<T, Object>, AnnotatedParameter<X>
{
- public WBMember<?, ?> getDeclaringMember();
-
}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBType.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBType.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBType.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.introspector;
-
-/**
- * AnnotatedType provides a uniform access to a type defined either in Java or
- * XML
- *
- * @author Pete Muir
- * @param <T>
- */
-public interface WBType<T> extends WBAnnotated<T, Class<T>>
-{
-
- /**
- * Gets the superclass of the type
- *
- * @return The abstracted superclass
- */
- public WBType<?> getSuperclass();
-
- /**
- * Check if this is equivalent to a java class
- * @param clazz The Java class
- * @return true if equivalent
- */
- public boolean isEquivalent(Class<?> clazz);
-
- public String getSimpleName();
-
-}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBCallable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBCallable.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBCallable.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.introspector.jlr;
+
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+
+import org.jboss.webbeans.introspector.AnnotationStore;
+import org.jboss.webbeans.introspector.WBCallable;
+import org.jboss.webbeans.introspector.WBClass;
+
+/**
+ * @author pmuir
+ *
+ */
+public abstract class AbstractWBCallable<T, X, S extends Member> extends AbstractWBMember<T, X, S> implements WBCallable<T, X, S>
+{
+
+
+
+ protected AbstractWBCallable(AnnotationStore annotatedItemHelper, Member member, Class<T> rawType, Type type, WBClass<X> declaringType)
+ {
+ super(annotatedItemHelper, member, rawType, type, declaringType);
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBCallable.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBMember.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBMember.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBMember.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -22,6 +22,7 @@
import org.jboss.webbeans.introspector.AnnotationStore;
import org.jboss.webbeans.introspector.ForwardingWBMember;
+import org.jboss.webbeans.introspector.WBClass;
import org.jboss.webbeans.introspector.WBMember;
import org.jboss.webbeans.util.Reflections;
@@ -35,10 +36,10 @@
* @param <T>
* @param <S>
*/
-public abstract class AbstractWBMember<T, S extends Member> extends AbstractWBAnnotated<T, S> implements WBMember<T, S>
+public abstract class AbstractWBMember<T, X, S extends Member> extends AbstractWBAnnotated<T, S> implements WBMember<T, X, S>
{
- static abstract class WrappableForwardingAnnotatedMember<T, S extends Member> extends ForwardingWBMember<T, S> implements WrappableAnnotatedItem<T, S>
+ static abstract class WrappableForwardingAnnotatedMember<T, X, S extends Member> extends ForwardingWBMember<T, X, S> implements WrappableAnnotatedItem<T, S>
{
}
@@ -48,22 +49,22 @@
// Cached string representation
private String toString;
-
private final boolean _public;
-
private final boolean _private;
+ private final WBClass<X> declaringType;
/**
* Constructor
*
* @param annotationMap The annotation map
*/
- protected AbstractWBMember(AnnotationStore annotatedItemHelper, Member member, Class<T> rawType, Type type)
+ protected AbstractWBMember(AnnotationStore annotatedItemHelper, Member member, Class<T> rawType, Type type, WBClass<X> declaringType)
{
super(annotatedItemHelper, rawType, type);
name = member.getName();
_public = Modifier.isPublic(member.getModifiers());
_private = Modifier.isPrivate(member.getModifiers());
+ this.declaringType = declaringType;
}
/**
@@ -148,5 +149,10 @@
{
return getDelegate();
}
+
+ public WBClass<X> getDeclaringType()
+ {
+ return declaringType;
+ }
}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBType.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBType.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBType.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -1,156 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.introspector.jlr;
-
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Type;
-
-import org.jboss.webbeans.introspector.AnnotationStore;
-import org.jboss.webbeans.introspector.WBClass;
-import org.jboss.webbeans.introspector.WBType;
-import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.util.Reflections;
-
-/**
- * Represents an abstract annotated type
- *
- * This class is immutable, and therefore threadsafe
- *
- * @author Pete Muir
- *
- * @param <T>
- */
-public abstract class AbstractWBType<T> extends AbstractWBAnnotated<T, Class<T>> implements WBType<T>
-{
-
- // The superclass abstraction of the type
- private final WBClass<?> superclass;
- // The name of the type
- private final String name;
-
- private final String _simpleName;
-
- // Cached string representation
- private String toString;
- private final boolean _public;
- private final boolean _private;
-
- /**
- * Constructor
- *
- * @param annotationMap The annotation map
- */
- public AbstractWBType(AnnotationStore annotatedItemHelper, Class<T> rawType, Type type, ClassTransformer classTransformer)
- {
- super(annotatedItemHelper, rawType, type);
- this.name = rawType.getName();
- this._simpleName = rawType.getSimpleName();
- if (rawType.getSuperclass() != null)
- {
- this.superclass = classTransformer.loadClass(rawType.getSuperclass());
- }
- else
- {
- this.superclass = null;
- }
- this._public = Modifier.isFinal(rawType.getModifiers());
- _private = Modifier.isPrivate(rawType.getModifiers());
- }
-
- /**
- * Indicates if the type is static
- *
- * @return True if static, false otherwise
- *
- * @see org.jboss.webbeans.introspector.WBAnnotated#isStatic()
- */
- public boolean isStatic()
- {
- return Reflections.isStatic(getDelegate());
- }
-
- /**
- * Indicates if the type if final
- *
- * @return True if final, false otherwise
- *
- * @see org.jboss.webbeans.introspector.WBAnnotated#isFinal()
- */
- public boolean isFinal()
- {
- return Reflections.isFinal(getDelegate());
- }
-
- public boolean isPublic()
- {
- return _public;
- }
-
- /**
- * Gets the name of the type
- *
- * @returns The name
- *
- * @see org.jboss.webbeans.introspector.WBAnnotated#getName()
- */
- public String getName()
- {
- return name;
- }
-
- /**
- * Gets the superclass abstraction of the type
- *
- * @return The superclass abstraction
- */
- public WBClass<?> getSuperclass()
- {
- return superclass;
- }
-
- public boolean isEquivalent(Class<?> clazz)
- {
- return getDelegate().equals(clazz);
- }
-
- public boolean isPrivate()
- {
- return _private;
- }
-
- /**
- * Gets a string representation of the type
- *
- * @return A string representation
- */
- @Override
- public String toString()
- {
- if (toString != null)
- {
- return toString;
- }
- toString = "Abstract annotated type " + getName();
- return toString;
- }
-
- public String getSimpleName()
- {
- return _simpleName;
- }
-
-}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/ConstructorSignatureImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/ConstructorSignatureImpl.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/ConstructorSignatureImpl.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -29,10 +29,10 @@
public ConstructorSignatureImpl(WBConstructor<?> method)
{
- this.parameterTypes = new String[method.getParameters().size()];
- for (int i = 0; i < method.getParameters().size(); i++)
+ this.parameterTypes = new String[method.getWBParameters().size()];
+ for (int i = 0; i < method.getWBParameters().size(); i++)
{
- parameterTypes[i] = method.getParameters().get(i).getJavaClass().getName();
+ parameterTypes[i] = method.getWBParameters().get(i).getJavaClass().getName();
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/MethodSignatureImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/MethodSignatureImpl.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/MethodSignatureImpl.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -30,13 +30,13 @@
private final String methodName;
private final String[] parameterTypes;
- public MethodSignatureImpl(WBMethod<?> method)
+ public MethodSignatureImpl(WBMethod<?, ?> method)
{
this.methodName = method.getName();
- this.parameterTypes = new String[method.getParameters().size()];
- for (int i = 0; i < method.getParameters().size(); i++)
+ this.parameterTypes = new String[method.getWBParameters().size()];
+ for (int i = 0; i < method.getWBParameters().size(); i++)
{
- parameterTypes[i] = method.getParameters().get(i).getJavaClass().getName();
+ parameterTypes[i] = method.getWBParameters().get(i).getJavaClass().getName();
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBAnnotationImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBAnnotationImpl.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBAnnotationImpl.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -44,17 +44,17 @@
*
* @param <T>
*/
-public class WBAnnotationImpl<T extends Annotation> extends AbstractWBType<T> implements WBAnnotation<T>
+public class WBAnnotationImpl<T extends Annotation> extends WBClassImpl<T> implements WBAnnotation<T>
{
// The annotated members map (annotation -> member with annotation)
- private final SetMultimap<Class<? extends Annotation>, WBMethod<?>> annotatedMembers;
+ private final SetMultimap<Class<? extends Annotation>, WBMethod<?, ?>> annotatedMembers;
// The implementation class of the annotation
private final Class<T> clazz;
// The set of abstracted members
- private final Set<WBMethod<?>> members;
+ private final Set<WBMethod<?, ?>> members;
- private final Map<String, WBMethod<?>> namedMembers;
+ private final Map<String, WBMethod<?, ?>> namedMembers;
// Cached string representation
private String toString;
@@ -73,22 +73,22 @@
*/
protected WBAnnotationImpl(Class<T> annotationType, ClassTransformer classTransformer)
{
- super(AnnotationStore.of(annotationType, classTransformer.getTypeStore().get(annotationType), classTransformer.getTypeStore().get(annotationType), classTransformer.getTypeStore()), annotationType, annotationType, classTransformer);
+ super(annotationType, annotationType, AnnotationStore.of(annotationType, classTransformer.getTypeStore().get(annotationType), classTransformer.getTypeStore().get(annotationType), classTransformer.getTypeStore()), classTransformer);
this.clazz = annotationType;
- members = new HashSet<WBMethod<?>>();
- annotatedMembers = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBMethod<?>>>(), new Supplier<Set<WBMethod<?>>>()
+ members = new HashSet<WBMethod<?, ?>>();
+ annotatedMembers = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBMethod<?, ?>>>(), new Supplier<Set<WBMethod<?, ?>>>()
{
- public Set<WBMethod<?>> get()
+ public Set<WBMethod<?, ?>> get()
{
- return new HashSet<WBMethod<?>>();
+ return new HashSet<WBMethod<?, ?>>();
}
});
- this.namedMembers = new HashMap<String, WBMethod<?>>();
+ this.namedMembers = new HashMap<String, WBMethod<?, ?>>();
for (Method member : clazz.getDeclaredMethods())
{
- WBMethod<?> annotatedMethod = WBMethodImpl.of(member, this, classTransformer);
+ WBMethod<?, ?> annotatedMethod = WBMethodImpl.of(member, this, classTransformer);
members.add(annotatedMethod);
for (Annotation annotation : annotatedMethod.getAnnotations())
{
@@ -107,7 +107,7 @@
*
* @see org.jboss.webbeans.introspector.WBAnnotation#getMembers()
*/
- public Set<WBMethod<?>> getMembers()
+ public Set<WBMethod<?, ?>> getMembers()
{
return Collections.unmodifiableSet(members);
}
@@ -123,14 +123,14 @@
*
* @see org.jboss.webbeans.introspector.WBAnnotation#getAnnotatedMembers(Class)
*/
- public Set<WBMethod<?>> getAnnotatedMembers(Class<? extends Annotation> annotationType)
+ public Set<WBMethod<?, ?>> getAnnotatedMembers(Class<? extends Annotation> annotationType)
{
return Collections.unmodifiableSet(annotatedMembers.get(annotationType));
}
- public <A> WBMethod<A> getMember(String memberName, WBClass<A> expectedType)
+ public <A> WBMethod<A, ?> getMember(String memberName, WBClass<A> expectedType)
{
- return (WBMethod<A>) namedMembers.get(memberName);
+ return (WBMethod<A, ?>) namedMembers.get(memberName);
}
/**
@@ -152,9 +152,4 @@
{
return clazz;
}
-
- public WBAnnotation<T> wrap(Set<Annotation> annotations)
- {
- throw new UnsupportedOperationException();
- }
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -20,6 +20,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.Collection;
@@ -30,6 +31,9 @@
import java.util.Map;
import java.util.Set;
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.AnnotatedType;
import org.jboss.webbeans.introspector.AnnotationStore;
@@ -56,41 +60,51 @@
*
* @param <T>
*/
-public class WBClassImpl<T> extends AbstractWBType<T> implements WBClass<T>
+public class WBClassImpl<T> extends AbstractWBAnnotated<T, Class<T>> implements WBClass<T>
{
+
+// The superclass abstraction of the type
+ private final WBClass<?> superclass;
+ // The name of the type
+ private final String name;
+
+ private final String _simpleName;
+ private final boolean _public;
+ private final boolean _private;
+
private static List<Class<?>> NO_ARGUMENTS = Collections.emptyList();
// The set of abstracted fields
- private final Set<WBField<?>> fields;
+ private final Set<WBField<?, ?>> fields;
// The map from annotation type to abstracted field with annotation
- private final SetMultimap<Class<? extends Annotation>, WBField<?>> annotatedFields;
+ private final SetMultimap<Class<? extends Annotation>, WBField<?, ?>> annotatedFields;
// The map from annotation type to abstracted field with meta-annotation
- private final SetMultimap<Class<? extends Annotation>, WBField<?>> metaAnnotatedFields;
+ private final SetMultimap<Class<? extends Annotation>, WBField<?, ?>> metaAnnotatedFields;
// The set of abstracted fields
- private final Set<WBField<?>> declaredFields;
- private final Map<String, WBField<?>> declaredFieldsByName;
+ private final Set<WBField<?, ?>> declaredFields;
+ private final Map<String, WBField<?, ?>> declaredFieldsByName;
// The map from annotation type to abstracted field with annotation
- private final SetMultimap<Class<? extends Annotation>, WBField<?>> declaredAnnotatedFields;
+ private final SetMultimap<Class<? extends Annotation>, WBField<?, ?>> declaredAnnotatedFields;
// The map from annotation type to abstracted field with meta-annotation
- private final SetMultimap<Class<? extends Annotation>, WBField<?>> declaredMetaAnnotatedFields;
+ private final SetMultimap<Class<? extends Annotation>, WBField<?, ?>> declaredMetaAnnotatedFields;
// The set of abstracted methods
- private final Set<WBMethod<?>> methods;
- private final Map<MethodSignature, WBMethod<?>> declaredMethodsBySignature;
- private final Map<MethodSignature, WBMethod<?>> methodsBySignature;
+ private final Set<WBMethod<?, ?>> methods;
+ private final Map<MethodSignature, WBMethod<?, ?>> declaredMethodsBySignature;
+ private final Map<MethodSignature, WBMethod<?, ?>> methodsBySignature;
// The map from annotation type to abstracted method with annotation
- private final SetMultimap<Class<? extends Annotation>, WBMethod<?>> annotatedMethods;
+ private final SetMultimap<Class<? extends Annotation>, WBMethod<?, ?>> annotatedMethods;
// The map from annotation type to method with a parameter with annotation
- private final SetMultimap<Class<? extends Annotation>, WBMethod<?>> methodsByAnnotatedParameters;
+ private final SetMultimap<Class<? extends Annotation>, WBMethod<?, ?>> methodsByAnnotatedParameters;
// The set of abstracted methods
- private final Set<WBMethod<?>> declaredMethods;
+ private final Set<WBMethod<?, ?>> declaredMethods;
// The map from annotation type to abstracted method with annotation
- private final SetMultimap<Class<? extends Annotation>, WBMethod<?>> declaredAnnotatedMethods;
+ private final SetMultimap<Class<? extends Annotation>, WBMethod<?, ?>> declaredAnnotatedMethods;
// The map from annotation type to method with a parameter with annotation
- private final SetMultimap<Class<? extends Annotation>, WBMethod<?>> declaredMethodsByAnnotatedParameters;
+ private final SetMultimap<Class<? extends Annotation>, WBMethod<?, ?>> declaredMethodsByAnnotatedParameters;
// The set of abstracted constructors
private final Set<WBConstructor<T>> constructors;
@@ -121,46 +135,58 @@
return new WBClassImpl<T>(annotatedType.getJavaClass(), annotatedType.getBaseType(), annotationStore, classTransformer);
}
- private WBClassImpl(Class<T> rawType, Type type, AnnotationStore annotationStore, ClassTransformer classTransformer)
+ protected WBClassImpl(Class<T> rawType, Type type, AnnotationStore annotationStore, ClassTransformer classTransformer)
{
- super(annotationStore, rawType, type, classTransformer);
+ super(annotationStore, rawType, type);
+ this.name = rawType.getName();
+ this._simpleName = rawType.getSimpleName();
+ if (rawType.getSuperclass() != null)
+ {
+ this.superclass = classTransformer.loadClass(rawType.getSuperclass());
+ }
+ else
+ {
+ this.superclass = null;
+ }
+ this._public = Modifier.isFinal(rawType.getModifiers());
+ _private = Modifier.isPrivate(rawType.getModifiers());
- this.fields = new HashSet<WBField<?>>();
- this.annotatedFields = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBField<?>>>(), new Supplier< Set<WBField<?>>>()
+ this.fields = new HashSet<WBField<?, ?>>();
+ this.annotatedFields = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBField<?, ?>>>(), new Supplier< Set<WBField<?, ?>>>()
{
- public Set<WBField<?>> get()
+ public Set<WBField<?, ?>> get()
{
- return new HashSet<WBField<?>>();
+ return new HashSet<WBField<?, ?>>();
}
});
- this.metaAnnotatedFields = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBField<?>>>(), new Supplier< Set<WBField<?>>>()
+ this.metaAnnotatedFields = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBField<?, ?>>>(), new Supplier< Set<WBField<?, ?>>>()
{
- public Set<WBField<?>> get()
+ public Set<WBField<?, ?>> get()
{
- return new HashSet<WBField<?>>();
+ return new HashSet<WBField<?, ?>>();
}
});
- this.declaredFields = new HashSet<WBField<?>>();
- this.declaredFieldsByName = new HashMap<String, WBField<?>>();
- this.declaredAnnotatedFields = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBField<?>>>(), new Supplier< Set<WBField<?>>>()
+ this.declaredFields = new HashSet<WBField<?, ?>>();
+ this.declaredFieldsByName = new HashMap<String, WBField<?, ?>>();
+ this.declaredAnnotatedFields = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBField<?, ?>>>(), new Supplier< Set<WBField<?, ?>>>()
{
- public Set<WBField<?>> get()
+ public Set<WBField<?, ?>> get()
{
- return new HashSet<WBField<?>>();
+ return new HashSet<WBField<?, ?>>();
}
});
- this.declaredMetaAnnotatedFields = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBField<?>>>(), new Supplier< Set<WBField<?>>>()
+ this.declaredMetaAnnotatedFields = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBField<?, ?>>>(), new Supplier< Set<WBField<?, ?>>>()
{
- public Set<WBField<?>> get()
+ public Set<WBField<?, ?>> get()
{
- return new HashSet<WBField<?>>();
+ return new HashSet<WBField<?, ?>>();
}
});
@@ -175,7 +201,7 @@
{
field.setAccessible(true);
}
- WBField<?> annotatedField = WBFieldImpl.of(field, this, classTransformer);
+ WBField<?, ?> annotatedField = WBFieldImpl.of(field, this, classTransformer);
this.fields.add(annotatedField);
if (c == rawType)
{
@@ -248,53 +274,53 @@
for (Class<? extends Annotation> annotationType : WBConstructor.MAPPED_PARAMETER_ANNOTATIONS)
{
- if (annotatedConstructor.getAnnotatedParameters(annotationType).size() > 0)
+ if (annotatedConstructor.getAnnotatedWBParameters(annotationType).size() > 0)
{
constructorsByAnnotatedParameters.put(annotationType, annotatedConstructor);
}
}
}
- this.methods = new HashSet<WBMethod<?>>();
- this.annotatedMethods = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBMethod<?>>>(), new Supplier< Set<WBMethod<?>>>()
+ this.methods = new HashSet<WBMethod<?, ?>>();
+ this.annotatedMethods = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBMethod<?, ?>>>(), new Supplier< Set<WBMethod<?, ?>>>()
{
- public Set<WBMethod<?>> get()
+ public Set<WBMethod<?, ?>> get()
{
- return new HashSet<WBMethod<?>>();
+ return new HashSet<WBMethod<?, ?>>();
}
});
- this.methodsByAnnotatedParameters = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBMethod<?>>>(), new Supplier< Set<WBMethod<?>>>()
+ this.methodsByAnnotatedParameters = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBMethod<?, ?>>>(), new Supplier< Set<WBMethod<?, ?>>>()
{
- public Set<WBMethod<?>> get()
+ public Set<WBMethod<?, ?>> get()
{
- return new HashSet<WBMethod<?>>();
+ return new HashSet<WBMethod<?, ?>>();
}
});
- this.declaredMethods = new HashSet<WBMethod<?>>();
- this.declaredAnnotatedMethods = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBMethod<?>>>(), new Supplier< Set<WBMethod<?>>>()
+ this.declaredMethods = new HashSet<WBMethod<?, ?>>();
+ this.declaredAnnotatedMethods = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBMethod<?, ?>>>(), new Supplier< Set<WBMethod<?, ?>>>()
{
- public Set<WBMethod<?>> get()
+ public Set<WBMethod<?, ?>> get()
{
- return new HashSet<WBMethod<?>>();
+ return new HashSet<WBMethod<?, ?>>();
}
});
- this.declaredMethodsByAnnotatedParameters = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBMethod<?>>>(), new Supplier< Set<WBMethod<?>>>()
+ this.declaredMethodsByAnnotatedParameters = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBMethod<?, ?>>>(), new Supplier< Set<WBMethod<?, ?>>>()
{
- public Set<WBMethod<?>> get()
+ public Set<WBMethod<?, ?>> get()
{
- return new HashSet<WBMethod<?>>();
+ return new HashSet<WBMethod<?, ?>>();
}
});
- this.declaredMethodsBySignature = new HashMap<MethodSignature, WBMethod<?>>();
- this.methodsBySignature = new HashMap<MethodSignature, WBMethod<?>>();
+ this.declaredMethodsBySignature = new HashMap<MethodSignature, WBMethod<?, ?>>();
+ this.methodsBySignature = new HashMap<MethodSignature, WBMethod<?, ?>>();
for (Class<?> c = rawType; c != Object.class && c != null; c = c.getSuperclass())
{
for (Method method : c.getDeclaredMethods())
@@ -304,7 +330,7 @@
method.setAccessible(true);
}
- WBMethod<?> annotatedMethod = WBMethodImpl.of(method, this, classTransformer);
+ WBMethod<?, ?> annotatedMethod = WBMethodImpl.of(method, this, classTransformer);
this.methods.add(annotatedMethod);
this.methodsBySignature.put(annotatedMethod.getSignature(), annotatedMethod);
if (c == rawType)
@@ -322,7 +348,7 @@
}
for (Class<? extends Annotation> annotationType : WBMethod.MAPPED_PARAMETER_ANNOTATIONS)
{
- if (annotatedMethod.getAnnotatedParameters(annotationType).size() > 0)
+ if (annotatedMethod.getAnnotatedWBParameters(annotationType).size() > 0)
{
methodsByAnnotatedParameters.put(annotationType, annotatedMethod);
if (c == rawType)
@@ -362,22 +388,22 @@
*
* @return The set of abstracted fields
*/
- public Set<WBField<?>> getFields()
+ public Set<WBField<?, ?>> getWBFields()
{
return Collections.unmodifiableSet(fields);
}
- public Set<WBField<?>> getDeclaredFields()
+ public Set<WBField<?, ?>> getDeclaredFields()
{
return Collections.unmodifiableSet(declaredFields);
}
- public <F> WBField<F> getDeclaredField(String fieldName, WBClass<F> expectedType)
+ public <F> WBField<F, ?> getDeclaredWBField(String fieldName, WBClass<F> expectedType)
{
- return (WBField<F>) declaredFieldsByName.get(fieldName);
+ return (WBField<F, ?>) declaredFieldsByName.get(fieldName);
}
- public Set<WBField<?>> getDeclaredAnnotatedFields(Class<? extends Annotation> annotationType)
+ public Set<WBField<?, ?>> getDeclaredAnnotatedWBFields(Class<? extends Annotation> annotationType)
{
return Collections.unmodifiableSet(declaredAnnotatedFields.get(annotationType));
}
@@ -389,12 +415,12 @@
*
* @return The set of abstracted constructors
*/
- public Set<WBConstructor<T>> getConstructors()
+ public Set<WBConstructor<T>> getWBConstructors()
{
return Collections.unmodifiableSet(constructors);
}
- public WBConstructor<T> getDeclaredConstructor(ConstructorSignature signature)
+ public WBConstructor<T> getDeclaredWBConstructor(ConstructorSignature signature)
{
return (WBConstructor<T>) declaredConstructorsBySignature.get(signature);
}
@@ -411,7 +437,7 @@
* @return The set of abstracted fields with meta-annotation present. Returns
* an empty set if no matches are found.
*/
- public Set<WBField<?>> getMetaAnnotatedFields(Class<? extends Annotation> metaAnnotationType)
+ public Set<WBField<?, ?>> getMetaAnnotatedWBFields(Class<? extends Annotation> metaAnnotationType)
{
return Collections.unmodifiableSet(metaAnnotatedFields.get(metaAnnotationType));
}
@@ -425,7 +451,7 @@
* @return A set of matching abstracted fields, null if none are found.
*
*/
- public Set<WBField<?>> getAnnotatedFields(Class<? extends Annotation> annotationType)
+ public Set<WBField<?, ?>> getAnnotatedWBFields(Class<? extends Annotation> annotationType)
{
return Collections.unmodifiableSet(annotatedFields.get(annotationType));
}
@@ -454,14 +480,14 @@
* @return A set of matching method abstractions. Returns an empty set if no
* matches are found.
*
- * @see org.jboss.webbeans.introspector.WBClass#getAnnotatedMethods(Class)
+ * @see org.jboss.webbeans.introspector.WBClass#getAnnotatedWBMethods(Class)
*/
- public Set<WBMethod<?>> getAnnotatedMethods(Class<? extends Annotation> annotationType)
+ public Set<WBMethod<?, ?>> getAnnotatedWBMethods(Class<? extends Annotation> annotationType)
{
return Collections.unmodifiableSet(annotatedMethods.get(annotationType));
}
- public Set<WBMethod<?>> getDeclaredAnnotatedMethods(Class<? extends Annotation> annotationType)
+ public Set<WBMethod<?, ?>> getDeclaredWBAnnotatedMethods(Class<? extends Annotation> annotationType)
{
return Collections.unmodifiableSet(declaredAnnotatedMethods.get(annotationType));
}
@@ -474,37 +500,37 @@
* the constructors set is empty, initialize it first. Returns an
* empty set if there are no matches.
*
- * @see org.jboss.webbeans.introspector.WBClass#getAnnotatedConstructors(Class)
+ * @see org.jboss.webbeans.introspector.WBClass#getAnnotatedWBConstructors(Class)
*/
- public Set<WBConstructor<T>> getAnnotatedConstructors(Class<? extends Annotation> annotationType)
+ public Set<WBConstructor<T>> getAnnotatedWBConstructors(Class<? extends Annotation> annotationType)
{
return Collections.unmodifiableSet(annotatedConstructors.get(annotationType));
}
- public WBConstructor<T> getNoArgsConstructor()
+ public WBConstructor<T> getNoArgsWBConstructor()
{
return constructorsByArgumentMap.get(NO_ARGUMENTS);
}
- public Set<WBMethod<?>> getMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
+ public Set<WBMethod<?, ?>> getWBMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
{
return Collections.unmodifiableSet(methodsByAnnotatedParameters.get(annotationType));
}
- public Set<WBConstructor<?>> getConstructorsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
+ public Set<WBConstructor<?>> getWBConstructorsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
{
return Collections.unmodifiableSet(constructorsByAnnotatedParameters.get(annotationType));
}
- public Set<WBMethod<?>> getDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
+ public Set<WBMethod<?, ?>> getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
{
return Collections.unmodifiableSet(declaredMethodsByAnnotatedParameters.get(annotationType));
}
- public WBMethod<?> getMethod(Method methodDescriptor)
+ public WBMethod<?, ?> getWBMethod(Method methodDescriptor)
{
// TODO Should be cached
- for (WBMethod<?> annotatedMethod : methods)
+ for (WBMethod<?, ?> annotatedMethod : methods)
{
if (annotatedMethod.getName().equals(methodDescriptor.getName()) && Arrays.equals(annotatedMethod.getParameterTypesAsArray(), methodDescriptor.getParameterTypes()))
{
@@ -514,15 +540,15 @@
return null;
}
- public Set<WBMethod<?>> getMethods()
+ public Set<WBMethod<?, ?>> getWBMethods()
{
return Collections.unmodifiableSet(methods);
}
- public WBMethod<?> getDeclaredMethod(Method method)
+ public WBMethod<?, ?> getDeclaredWBMethod(Method method)
{
// TODO Should be cached
- for (WBMethod<?> annotatedMethod : declaredMethods)
+ for (WBMethod<?, ?> annotatedMethod : declaredMethods)
{
if (annotatedMethod.getName().equals(method.getName()) && Arrays.equals(annotatedMethod.getParameterTypesAsArray(), method.getParameterTypes()))
{
@@ -533,15 +559,15 @@
}
@SuppressWarnings("unchecked")
- public <M> WBMethod<M> getDeclaredMethod(MethodSignature signature, WBClass<M> expectedReturnType)
+ public <M> WBMethod<M, ?> getDeclaredWBMethod(MethodSignature signature, WBClass<M> expectedReturnType)
{
- return (WBMethod<M>) declaredMethodsBySignature.get(signature);
+ return (WBMethod<M, ?>) declaredMethodsBySignature.get(signature);
}
@SuppressWarnings("unchecked")
- public <M> WBMethod<M> getMethod(MethodSignature signature)
+ public <M> WBMethod<M, ?> getWBMethod(MethodSignature signature)
{
- return (WBMethod<M>) methodsBySignature.get(signature);
+ return (WBMethod<M, ?>) methodsBySignature.get(signature);
}
/**
@@ -559,17 +585,101 @@
toString = "Annotated class " + Names.classToString(getDelegate());
return toString;
}
+
+ public String getSimpleName()
+ {
+ return _simpleName;
+ }
+
+ /**
+ * Indicates if the type is static
+ *
+ * @return True if static, false otherwise
+ *
+ * @see org.jboss.webbeans.introspector.WBAnnotated#isStatic()
+ */
+ public boolean isStatic()
+ {
+ return Reflections.isStatic(getDelegate());
+ }
+ /**
+ * Indicates if the type if final
+ *
+ * @return True if final, false otherwise
+ *
+ * @see org.jboss.webbeans.introspector.WBAnnotated#isFinal()
+ */
+ public boolean isFinal()
+ {
+ return Reflections.isFinal(getDelegate());
+ }
+
+ public boolean isPublic()
+ {
+ return _public;
+ }
+
+ /**
+ * Gets the name of the type
+ *
+ * @returns The name
+ *
+ * @see org.jboss.webbeans.introspector.WBAnnotated#getName()
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Gets the superclass abstraction of the type
+ *
+ * @return The superclass abstraction
+ */
+ public WBClass<?> getWBSuperclass()
+ {
+ return superclass;
+ }
+
+ public boolean isEquivalent(Class<?> clazz)
+ {
+ return getDelegate().equals(clazz);
+ }
+
+ public boolean isPrivate()
+ {
+ return _private;
+ }
+
@SuppressWarnings("unchecked")
- public <U> WBClass<? extends U> asSubclass(WBClass<U> clazz)
+ public <U> WBClass<? extends U> asWBSubclass(WBClass<U> clazz)
{
return (WBClass<? extends U>) this;
}
@SuppressWarnings("unchecked")
- public T cast(Object object)
+ public <S> S cast(Object object)
{
- return (T) object;
+ return (S) object;
}
+ @SuppressWarnings("unchecked")
+ public Set<AnnotatedConstructor<T>> getConstructors()
+ {
+ return (Set) constructors;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Set<AnnotatedField<? super T>> getFields()
+ {
+ return (Set) fields;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Set<AnnotatedMethod<? super T>> getMethods()
+ {
+ return (Set) methods;
+ }
+
}
\ No newline at end of file
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBConstructorImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBConstructorImpl.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBConstructorImpl.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -27,13 +27,16 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
+import java.util.Set;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.introspector.AnnotationStore;
import org.jboss.webbeans.introspector.ConstructorSignature;
+import org.jboss.webbeans.introspector.WBClass;
import org.jboss.webbeans.introspector.WBConstructor;
import org.jboss.webbeans.introspector.WBParameter;
-import org.jboss.webbeans.introspector.WBType;
import org.jboss.webbeans.resources.ClassTransformer;
import org.jboss.webbeans.util.Names;
@@ -50,26 +53,23 @@
*
* @param <T>
*/
-public class WBConstructorImpl<T> extends AbstractWBMember<T, Constructor<T>> implements WBConstructor<T>
+public class WBConstructorImpl<T> extends AbstractWBCallable<T, T, Constructor<T>> implements WBConstructor<T>
{
// The underlying constructor
private final Constructor<T> constructor;
// The list of parameter abstractions
- private final List<WBParameter<?>> parameters;
+ private final List<WBParameter<?, ?>> parameters;
// The mapping of annotation -> parameter abstraction
- private final ListMultimap<Class<? extends Annotation>, WBParameter<?>> annotatedParameters;
-
- // The declaring class abstraction
- private final WBType<T> declaringClass;
+ private final ListMultimap<Class<? extends Annotation>, WBParameter<?, ?>> annotatedParameters;
private final ConstructorSignature signature;
// Cached string representation
private String toString;
- public static <T> WBConstructor<T> of(Constructor<T> constructor, WBType<T> declaringClass, ClassTransformer classTransformer)
+ public static <T> WBConstructor<T> of(Constructor<T> constructor, WBClass<T> declaringClass, ClassTransformer classTransformer)
{
return new WBConstructorImpl<T>(ensureAccessible(constructor), declaringClass, classTransformer);
}
@@ -82,19 +82,18 @@
* @param constructor The constructor method
* @param declaringClass The declaring class
*/
- private WBConstructorImpl(Constructor<T> constructor, WBType<T> declaringClass, ClassTransformer classTransformer)
+ private WBConstructorImpl(Constructor<T> constructor, WBClass<T> declaringClass, ClassTransformer classTransformer)
{
- super(AnnotationStore.of(constructor, classTransformer.getTypeStore()), constructor, constructor.getDeclaringClass(), constructor.getDeclaringClass());
+ super(AnnotationStore.of(constructor, classTransformer.getTypeStore()), constructor, constructor.getDeclaringClass(), constructor.getDeclaringClass(), declaringClass);
this.constructor = constructor;
- this.declaringClass = declaringClass;
- this.parameters = new ArrayList<WBParameter<?>>();
- annotatedParameters = Multimaps.newListMultimap(new HashMap<Class<? extends Annotation>, Collection<WBParameter<?>>>(), new Supplier< List<WBParameter<?>>>()
+ this.parameters = new ArrayList<WBParameter<?, ?>>();
+ annotatedParameters = Multimaps.newListMultimap(new HashMap<Class<? extends Annotation>, Collection<WBParameter<?, ?>>>(), new Supplier< List<WBParameter<?, ?>>>()
{
- public List<WBParameter<?>> get()
+ public List<WBParameter<?, ?>> get()
{
- return new ArrayList<WBParameter<?>>();
+ return new ArrayList<WBParameter<?, ?>>();
}
});
@@ -105,7 +104,7 @@
{
Class<?> clazz = constructor.getParameterTypes()[i];
Type type = constructor.getGenericParameterTypes()[i];
- WBParameter<?> parameter = WBParameterImpl.of(constructor.getParameterAnnotations()[i], clazz, type, this, classTransformer);
+ WBParameter<?, ?> parameter = WBParameterImpl.of(constructor.getParameterAnnotations()[i], clazz, type, this, i, classTransformer);
parameters.add(parameter);
for (Annotation annotation : parameter.getAnnotations())
@@ -125,7 +124,7 @@
{
type = clazz;
}
- WBParameter<?> parameter = WBParameterImpl.of(new Annotation[0], clazz, type, this, classTransformer);
+ WBParameter<?, ?> parameter = WBParameterImpl.of(new Annotation[0], clazz, type, this, i, classTransformer);
parameters.add(parameter);
for (Annotation annotation : parameter.getAnnotations())
@@ -165,9 +164,9 @@
*
* @return A list of annotated parameter abstractions
*
- * @see org.jboss.webbeans.introspector.WBConstructor#getParameters()
+ * @see org.jboss.webbeans.introspector.WBConstructor#getWBParameters()
*/
- public List<WBParameter<?>> getParameters()
+ public List<WBParameter<?, ?>> getWBParameters()
{
return Collections.unmodifiableList(parameters);
}
@@ -181,9 +180,9 @@
* @return A list of matching parameter abstractions. An empty list is
* returned if there are no matches.
*
- * @see org.jboss.webbeans.introspector.WBConstructor#getAnnotatedParameters(Class)
+ * @see org.jboss.webbeans.introspector.WBConstructor#getAnnotatedWBParameters(Class)
*/
- public List<WBParameter<?>> getAnnotatedParameters(Class<? extends Annotation> annotationType)
+ public List<WBParameter<?, ?>> getAnnotatedWBParameters(Class<? extends Annotation> annotationType)
{
return Collections.unmodifiableList(annotatedParameters.get(annotationType));
}
@@ -218,7 +217,7 @@
if (super.equals(other) && other instanceof WBConstructor)
{
WBConstructor<?> that = (WBConstructor<?>) other;
- return this.getDeclaringType().equals(that.getDeclaringType()) && this.getParameters().equals(that.getParameters());
+ return this.getDeclaringType().equals(that.getDeclaringType()) && this.getWBParameters().equals(that.getWBParameters());
}
return false;
}
@@ -237,16 +236,6 @@
}
/**
- * Gets the declaring class
- *
- * @return The declaring class
- */
- public WBType<T> getDeclaringType()
- {
- return declaringClass;
- }
-
- /**
* Gets a string representation of the constructor
*
* @return A string representation
@@ -266,5 +255,10 @@
{
return signature;
}
+
+ public List<AnnotatedParameter<T>> getParameters()
+ {
+ return new ArrayList<AnnotatedParameter<T>>((Set) parameters);
+ }
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBFieldImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBFieldImpl.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBFieldImpl.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -21,8 +21,8 @@
import java.lang.reflect.Field;
import org.jboss.webbeans.introspector.AnnotationStore;
+import org.jboss.webbeans.introspector.WBClass;
import org.jboss.webbeans.introspector.WBField;
-import org.jboss.webbeans.introspector.WBType;
import org.jboss.webbeans.resources.ClassTransformer;
import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Reflections;
@@ -36,20 +36,18 @@
*
* @param <T>
*/
-public class WBFieldImpl<T> extends AbstractWBMember<T, Field> implements WBField<T>
+public class WBFieldImpl<T, X> extends AbstractWBMember<T, X, Field> implements WBField<T, X>
{
// The underlying field
private final Field field;
- // The abstraction of the declaring class
- private final WBType<?> declaringClass;
// Cached string representation
private String toString;
- public static <T> WBFieldImpl<T> of(Field field, WBType<?> declaringClass, ClassTransformer classTransformer)
+ public static <T, X> WBFieldImpl<T, X> of(Field field, WBClass<X> declaringClass, ClassTransformer classTransformer)
{
- return new WBFieldImpl<T>(ensureAccessible(field), declaringClass, classTransformer);
+ return new WBFieldImpl<T, X>(ensureAccessible(field), declaringClass, classTransformer);
}
/**
@@ -61,11 +59,10 @@
* @param field The actual field
* @param declaringClass The abstraction of the declaring class
*/
- private WBFieldImpl(Field field, WBType<?> declaringClass, ClassTransformer classTransformer)
+ private WBFieldImpl(Field field, WBClass<X> declaringClass, ClassTransformer classTransformer)
{
- super(AnnotationStore.of(field, classTransformer.getTypeStore()), field, (Class<T>) field.getType(), field.getGenericType());
+ super(AnnotationStore.of(field, classTransformer.getTypeStore()), field, (Class<T>) field.getType(), field.getGenericType(), declaringClass);
this.field = field;
- this.declaringClass = declaringClass;
}
/**
@@ -112,18 +109,6 @@
}
/**
- * Gets the abstracted declaring class
- *
- * @return The declaring class
- *
- * @see org.jboss.webbeans.introspector.WBField#getDeclaringType()
- */
- public WBType<?> getDeclaringType()
- {
- return declaringClass;
- }
-
- /**
* Gets a string representation of the field
*
* @return A string representation
@@ -142,9 +127,9 @@
@Override
public boolean equals(Object other)
{
- if (other instanceof WBField)
+ if (other instanceof WBField<?, ?>)
{
- WBField<?> that = (WBField<?>) other;
+ WBField<?, ?> that = (WBField<?, ?>) other;
return this.getDeclaringType().equals(that.getDeclaringType()) && this.getName().equals(that.getName());
}
else
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBMethodImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBMethodImpl.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBMethodImpl.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -28,12 +28,15 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
+import java.util.Set;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+
import org.jboss.webbeans.introspector.AnnotationStore;
import org.jboss.webbeans.introspector.MethodSignature;
+import org.jboss.webbeans.introspector.WBClass;
import org.jboss.webbeans.introspector.WBMethod;
import org.jboss.webbeans.introspector.WBParameter;
-import org.jboss.webbeans.introspector.WBType;
import org.jboss.webbeans.resources.ClassTransformer;
import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Reflections;
@@ -51,32 +54,29 @@
*
* @param <T>
*/
-public class WBMethodImpl<T> extends AbstractWBMember<T, Method> implements WBMethod<T>
+public class WBMethodImpl<T, X> extends AbstractWBCallable<T, X, Method> implements WBMethod<T, X>
{
// The underlying method
private final Method method;
// The abstracted parameters
- private final List<WBParameter<?>> parameters;
+ private final List<WBParameter<?, ?>> parameters;
// A mapping from annotation type to parameter abstraction with that
// annotation present
- private final ListMultimap<Class<? extends Annotation>, WBParameter<?>> annotatedParameters;
+ private final ListMultimap<Class<? extends Annotation>, WBParameter<?, ?>> annotatedParameters;
// The property name
private final String propertyName;
- // The abstracted declaring class
- private final WBType<?> declaringClass;
-
// Cached string representation
private String toString;
private final MethodSignature signature;
- public static <T> WBMethodImpl<T> of(Method method, WBType<?> declaringClass, ClassTransformer classTransformer)
+ public static <T, X> WBMethodImpl<T, X> of(Method method, WBClass<X> declaringClass, ClassTransformer classTransformer)
{
- return new WBMethodImpl<T>(ensureAccessible(method), declaringClass, classTransformer);
+ return new WBMethodImpl<T, X>(ensureAccessible(method), declaringClass, classTransformer);
}
/**
@@ -89,18 +89,17 @@
* @param declaringClass The declaring class abstraction
*/
@SuppressWarnings("unchecked")
- private WBMethodImpl(Method method, WBType<?> declaringClass, ClassTransformer classTransformer)
+ private WBMethodImpl(Method method, WBClass<X> declaringClass, ClassTransformer classTransformer)
{
- super(AnnotationStore.of(method, classTransformer.getTypeStore()), method, (Class<T>) method.getReturnType(), method.getGenericReturnType());
+ super(AnnotationStore.of(method, classTransformer.getTypeStore()), method, (Class<T>) method.getReturnType(), method.getGenericReturnType(), declaringClass);
this.method = method;
- this.declaringClass = declaringClass;
- this.parameters = new ArrayList<WBParameter<?>>();
- this.annotatedParameters = Multimaps.newListMultimap(new HashMap<Class<? extends Annotation>, Collection<WBParameter<?>>>(), new Supplier< List<WBParameter<?>>>()
+ this.parameters = new ArrayList<WBParameter<?, ?>>();
+ this.annotatedParameters = Multimaps.newListMultimap(new HashMap<Class<? extends Annotation>, Collection<WBParameter<?, ?>>>(), new Supplier< List<WBParameter<?, ?>>>()
{
- public List<WBParameter<?>> get()
+ public List<WBParameter<?, ?>> get()
{
- return new ArrayList<WBParameter<?>>();
+ return new ArrayList<WBParameter<?, ?>>();
}
});
@@ -111,7 +110,7 @@
{
Class<? extends Object> clazz = method.getParameterTypes()[i];
Type type = method.getGenericParameterTypes()[i];
- WBParameter<?> parameter = WBParameterImpl.of(method.getParameterAnnotations()[i], (Class<Object>) clazz, type, this, classTransformer);
+ WBParameter<?, ?> parameter = WBParameterImpl.of(method.getParameterAnnotations()[i], (Class<Object>) clazz, type, this, i, classTransformer);
this.parameters.add(parameter);
for (Annotation annotation : parameter.getAnnotations())
{
@@ -125,7 +124,7 @@
{
Class<? extends Object> clazz = method.getParameterTypes()[i];
Type type = method.getGenericParameterTypes()[i];
- WBParameter<?> parameter = WBParameterImpl.of(new Annotation[0], (Class<Object>) clazz, type, this, classTransformer);
+ WBParameter<?, ?> parameter = WBParameterImpl.of(new Annotation[0], (Class<Object>) clazz, type, this, i, classTransformer);
this.parameters.add(parameter);
}
}
@@ -152,7 +151,7 @@
return method;
}
- public List<WBParameter<?>> getParameters()
+ public List<WBParameter<?, ?>> getWBParameters()
{
return Collections.unmodifiableList(parameters);
}
@@ -162,7 +161,7 @@
return method.getParameterTypes();
}
- public List<WBParameter<?>> getAnnotatedParameters(Class<? extends Annotation> annotationType)
+ public List<WBParameter<?, ?>> getAnnotatedWBParameters(Class<? extends Annotation> annotationType)
{
return Collections.unmodifiableList(annotatedParameters.get(annotationType));
}
@@ -172,8 +171,8 @@
{
if (other instanceof WBMethod)
{
- WBMethod<?> that = (WBMethod<?>) other;
- return this.getDeclaringType().equals(that.getDeclaringType()) && this.getName().equals(that.getName()) && this.getParameters().equals(that.getParameters());
+ WBMethod<?, ?> that = (WBMethod<?, ?>) other;
+ return this.getDeclaringType().equals(that.getDeclaringType()) && this.getName().equals(that.getName()) && this.getWBParameters().equals(that.getWBParameters());
}
else
{
@@ -212,11 +211,6 @@
return propertyName;
}
- public WBType<?> getDeclaringType()
- {
- return declaringClass;
- }
-
@Override
public String toString()
{
@@ -233,4 +227,9 @@
return signature;
}
+ public List<AnnotatedParameter<X>> getParameters()
+ {
+ return new ArrayList<AnnotatedParameter<X>>((Set) parameters);
+ }
+
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBParameterImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBParameterImpl.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBParameterImpl.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -18,10 +18,11 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
-import java.util.Set;
+import javax.enterprise.inject.spi.AnnotatedCallable;
+
import org.jboss.webbeans.introspector.AnnotationStore;
-import org.jboss.webbeans.introspector.WBMember;
+import org.jboss.webbeans.introspector.WBCallable;
import org.jboss.webbeans.introspector.WBParameter;
import org.jboss.webbeans.resources.ClassTransformer;
@@ -34,7 +35,7 @@
*
* @param <T>
*/
-public class WBParameterImpl<T> extends AbstractWBAnnotated<T, Object> implements WBParameter<T>
+public class WBParameterImpl<T, X> extends AbstractWBAnnotated<T, Object> implements WBParameter<T, X>
{
// The final state
@@ -43,14 +44,15 @@
private final boolean _static = false;
private final boolean _public = false;
private final boolean _private = false;
- private final WBMember<?, ?> declaringMember;
+ private final int position;
+ private final WBCallable<?, X, ?> declaringMember;
// Cached string representation
private String toString;
- public static <T> WBParameter<T> of(Annotation[] annotations, Class<T> rawType, Type type, WBMember<?, ?> declaringMember, ClassTransformer classTransformer)
+ public static <T, X> WBParameter<T, X> of(Annotation[] annotations, Class<T> rawType, Type type, WBCallable<?, X, ?> declaringMember, int position, ClassTransformer classTransformer)
{
- return new WBParameterImpl<T>(annotations, rawType, type, declaringMember, classTransformer);
+ return new WBParameterImpl<T, X>(annotations, rawType, type, declaringMember, position, classTransformer);
}
/**
@@ -59,25 +61,14 @@
* @param annotations The annotations array
* @param type The type of the parameter
*/
- protected WBParameterImpl(Annotation[] annotations, Class<T> rawType, Type type, WBMember<?, ?> declaringMember, ClassTransformer classTransformer)
+ protected WBParameterImpl(Annotation[] annotations, Class<T> rawType, Type type, WBCallable<?, X, ?> declaringMember, int position, ClassTransformer classTransformer)
{
super(AnnotationStore.of(annotations, annotations, classTransformer.getTypeStore()), rawType, type);
this.declaringMember = declaringMember;
+ this.position = position;
}
/**
- * Gets the delegate
- *
- * @return The delegate (null)
- *
- * @see org.jboss.webbeans.introspector.WBAnnotated#getDelegate()
- */
- public Object getDelegate()
- {
- return null;
- }
-
- /**
* Indicates if the parameter is final
*
* @return True if final, false otherwise
@@ -112,19 +103,6 @@
}
/**
- * Gets the current value
- *
- * @param beanManager The Web Beans manager
- * @return the value
- *
- * @see org.jboss.webbeans.introspector.AnnotatedParameter
- *
- public T getValue(BeanManager beanManager)
- {
- return beanManager.getInstanceByType(getRawType(), getMetaAnnotationsAsArray(BindingType.class));
- }*/
-
- /**
* Gets the name of the parameter
*
* @throws IllegalArgumentException (not supported)
@@ -154,20 +132,26 @@
buffer.append("final ");
buffer.append(getJavaClass().getName());
buffer.append(" for operation ");
- buffer.append(getDeclaringMember().toString());
+ buffer.append(getDeclaringCallable().toString());
toString = buffer.toString();
}
return toString;
}
- public WBMember<?, ?> getDeclaringMember()
+ public AnnotatedCallable<X> getDeclaringCallable()
{
return declaringMember;
}
+
+ public int getPosition()
+ {
+ return position;
+ }
- public WBParameter<T> wrap(Set<Annotation> annotations)
+ @Override
+ public Object getDelegate()
{
- throw new UnsupportedOperationException();
+ return null;
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/BindingTypeModel.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/BindingTypeModel.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/BindingTypeModel.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -49,7 +49,7 @@
private static final Log log = Logging.getLog(BindingTypeModel.class);
// The non-binding types
- private Set<WBMethod<?>> nonBindingTypes;
+ private Set<WBMethod<?, ?>> nonBindingTypes;
/**
@@ -94,7 +94,7 @@
*/
private void checkArrayAndAnnotationValuedMembers()
{
- for (WBMethod<?> annotatedMethod : getAnnotatedAnnotation().getMembers())
+ for (WBMethod<?, ?> annotatedMethod : getAnnotatedAnnotation().getMembers())
{
if ((Reflections.isArrayType(annotatedMethod.getJavaClass()) || Annotation.class.isAssignableFrom(annotatedMethod.getJavaClass())) && !nonBindingTypes.contains(annotatedMethod))
{
@@ -131,7 +131,7 @@
* @return A set of non-binding types, or an empty set if there are none
* present
*/
- public Set<WBMethod<?>> getNonBindingTypes()
+ public Set<WBMethod<?, ?>> getNonBindingTypes()
{
return nonBindingTypes;
}
@@ -155,7 +155,7 @@
{
if (instance.annotationType().equals(getRawType()) && other.annotationType().equals(getRawType()))
{
- for (WBMethod<?> annotatedMethod : getAnnotatedAnnotation().getMembers())
+ for (WBMethod<?, ?> annotatedMethod : getAnnotatedAnnotation().getMembers())
{
if (!nonBindingTypes.contains(annotatedMethod))
{
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeBeanResolver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeBeanResolver.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeBeanResolver.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -16,6 +16,7 @@
*/
package org.jboss.webbeans.resolution;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.Callable;
@@ -115,6 +116,11 @@
});
}
+
+ public <X> Set<Bean<? extends X>> resolve(final Collection<Bean<? extends X>> beans)
+ {
+ return resolve(new HashSet<Bean<? extends X>>(beans));
+ }
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -23,9 +23,14 @@
import java.util.Map;
import java.util.Set;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
import javax.decorator.Decorates;
import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.event.Observes;
import javax.enterprise.inject.BindingType;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Initializer;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.Bean;
@@ -34,9 +39,17 @@
import org.jboss.webbeans.bean.AbstractProducerBean;
import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.bean.RIBean;
+import org.jboss.webbeans.injection.ConstructorInjectionPoint;
import org.jboss.webbeans.injection.FieldInjectionPoint;
+import org.jboss.webbeans.injection.MethodInjectionPoint;
+import org.jboss.webbeans.injection.ParameterInjectionPoint;
import org.jboss.webbeans.introspector.WBClass;
+import org.jboss.webbeans.introspector.WBConstructor;
import org.jboss.webbeans.introspector.WBField;
+import org.jboss.webbeans.introspector.WBMethod;
+import org.jboss.webbeans.introspector.WBParameter;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.metadata.cache.BindingTypeModel;
import org.jboss.webbeans.metadata.cache.MetaAnnotationStore;
@@ -49,6 +62,9 @@
*/
public class Beans
{
+
+ private static final Log log = Logging.getLog(Beans.class);
+
/**
* Indicates if a bean's scope type is passivating
*
@@ -108,22 +124,117 @@
}
}
- public static Set<FieldInjectionPoint<?>> getFieldInjectionPoints(WBClass<?> annotatedItem, Bean<?> declaringBean)
+ public static Set<FieldInjectionPoint<?, ?>> getFieldInjectionPoints(Bean<?> declaringBean, WBClass<?> annotatedItem)
{
- Set<FieldInjectionPoint<?>> injectableFields = new HashSet<FieldInjectionPoint<?>>();
- for (WBField<?> annotatedField : annotatedItem.getMetaAnnotatedFields(BindingType.class))
+ Set<FieldInjectionPoint<?, ?>> injectableFields = new HashSet<FieldInjectionPoint<?, ?>>();
+ for (WBField<?, ?> annotatedField : annotatedItem.getMetaAnnotatedWBFields(BindingType.class))
{
addFieldInjectionPoint(annotatedField, injectableFields, declaringBean);
}
- for (WBField<?> annotatedField : annotatedItem.getAnnotatedFields(Decorates.class))
+ for (WBField<?, ?> annotatedField : annotatedItem.getAnnotatedWBFields(Decorates.class))
{
addFieldInjectionPoint(annotatedField, injectableFields, declaringBean);
}
return injectableFields;
}
- private static void addFieldInjectionPoint(WBField<?> annotatedField, Set<FieldInjectionPoint<?>> injectableFields, Bean<?> declaringBean)
+ public static WBMethod<?, ?> getPostConstruct(WBClass<?> type)
{
+ Set<WBMethod<?, ?>> postConstructMethods = type.getAnnotatedWBMethods(PostConstruct.class);
+ log.trace("Found " + postConstructMethods + " constructors annotated with @Initializer for " + type);
+ if (postConstructMethods.size() > 1)
+ {
+ throw new DefinitionException("Cannot have more than one post construct method annotated with @PostConstruct for " + type);
+ }
+ else if (postConstructMethods.size() == 1)
+ {
+ WBMethod<?, ?> postConstruct = postConstructMethods.iterator().next();
+ log.trace("Exactly one post construct method (" + postConstruct + ") for " + type);
+ return postConstruct;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static WBMethod<?, ?> getPreDestroy(WBClass<?> type)
+ {
+ Set<WBMethod<?, ?>> preDestroyMethods = type.getAnnotatedWBMethods(PreDestroy.class);
+ log.trace("Found " + preDestroyMethods + " constructors annotated with @Initializer for " + type);
+ if (preDestroyMethods.size() > 1)
+ {
+ // TODO actually this is wrong, in EJB you can have @PreDestroy methods
+ // on the superclass, though the Web Beans spec is silent on the issue
+ throw new DefinitionException("Cannot have more than one pre destroy method annotated with @PreDestroy for " + type);
+ }
+ else if (preDestroyMethods.size() == 1)
+ {
+ WBMethod<?, ?> preDestroy = preDestroyMethods.iterator().next();
+ log.trace("Exactly one post construct method (" + preDestroy + ") for " + type);
+ return preDestroy;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static Set<MethodInjectionPoint<?, ?>> getInitializerMethods(Bean<?> declaringBean, WBClass<?> type)
+ {
+ Set<MethodInjectionPoint<?, ?>> initializerMethods = new HashSet<MethodInjectionPoint<?, ?>>();
+ for (WBMethod<?, ?> method : type.getAnnotatedWBMethods(Initializer.class))
+ {
+ if (method.isStatic())
+ {
+ throw new DefinitionException("Initializer method " + method.toString() + " cannot be static on " + type);
+ }
+ else if (method.getAnnotation(Produces.class) != null)
+ {
+ throw new DefinitionException("Initializer method " + method.toString() + " cannot be annotated @Produces on " + type);
+ }
+ else if (method.getAnnotatedWBParameters(Disposes.class).size() > 0)
+ {
+ throw new DefinitionException("Initializer method " + method.toString() + " cannot have parameters annotated @Disposes on " + type);
+ }
+ else if (method.getAnnotatedWBParameters(Observes.class).size() > 0)
+ {
+ throw new DefinitionException("Initializer method " + method.toString() + " cannot be annotated @Observes on " + type);
+ }
+ else
+ {
+ MethodInjectionPoint<?, ?> initializerMethod = MethodInjectionPoint.of(declaringBean, method);
+ initializerMethods.add(initializerMethod);
+ }
+ }
+ return initializerMethods;
+ }
+
+ public static Set<ParameterInjectionPoint<?, ?>> getParameterInjectionPoints(Bean<?> declaringBean, WBConstructor<?> constructor)
+ {
+ Set<ParameterInjectionPoint<?,?>> injectionPoints = new HashSet<ParameterInjectionPoint<?,?>>();
+ for (WBParameter<?, ?> parameter : constructor.getWBParameters())
+ {
+ injectionPoints.add(ParameterInjectionPoint.of(declaringBean, parameter));
+ }
+ return injectionPoints;
+ }
+
+ public static Set<ParameterInjectionPoint<?, ?>> getParameterInjectionPoints(Bean<?> declaringBean, Set<MethodInjectionPoint<?, ?>> methodInjectionPoints)
+ {
+ Set<ParameterInjectionPoint<?, ?>> injectionPoints = new HashSet<ParameterInjectionPoint<?,?>>();
+ for (MethodInjectionPoint<?, ?> method : methodInjectionPoints)
+ {
+ for (WBParameter<?, ?> parameter : method.getWBParameters())
+ {
+ injectionPoints.add(ParameterInjectionPoint.of(declaringBean, parameter));
+ }
+ }
+ return injectionPoints;
+ }
+
+ private static void addFieldInjectionPoint(WBField<?, ?> annotatedField, Set<FieldInjectionPoint<?, ?>> injectableFields, Bean<?> declaringBean)
+ {
if (!annotatedField.isAnnotationPresent(Produces.class))
{
if (annotatedField.isStatic())
@@ -134,7 +245,7 @@
{
throw new DefinitionException("Don't place binding annotations on final fields " + annotatedField);
}
- FieldInjectionPoint<?> fieldInjectionPoint = FieldInjectionPoint.of(declaringBean, annotatedField);
+ FieldInjectionPoint<?, ?> fieldInjectionPoint = FieldInjectionPoint.of(declaringBean, annotatedField);
injectableFields.add(fieldInjectionPoint);
}
}
@@ -267,4 +378,38 @@
return false;
}
+ public static <T> ConstructorInjectionPoint<T> getBeanConstructor(Bean<?> declaringBean, WBClass<T> type)
+ {
+ ConstructorInjectionPoint<T> constructor = null;
+ Set<WBConstructor<T>> initializerAnnotatedConstructors = type.getAnnotatedWBConstructors(Initializer.class);
+ log.trace("Found " + initializerAnnotatedConstructors + " constructors annotated with @Initializer for " + type);
+ if (initializerAnnotatedConstructors.size() > 1)
+ {
+ if (initializerAnnotatedConstructors.size() > 1)
+ {
+ throw new DefinitionException("Cannot have more than one constructor annotated with @Initializer for " + type);
+ }
+ }
+ else if (initializerAnnotatedConstructors.size() == 1)
+ {
+ constructor = ConstructorInjectionPoint.of(declaringBean, initializerAnnotatedConstructors.iterator().next());
+ log.trace("Exactly one constructor (" + constructor + ") annotated with @Initializer defined, using it as the bean constructor for " + type);
+ }
+ else if (type.getNoArgsWBConstructor() != null)
+ {
+
+ constructor = ConstructorInjectionPoint.of(declaringBean, type.getNoArgsWBConstructor());
+ log.trace("Exactly one constructor (" + constructor + ") defined, using it as the bean constructor for " + type);
+ }
+
+ if (constructor == null)
+ {
+ throw new DefinitionException("Cannot determine constructor to use for " + type);
+ }
+ else
+ {
+ return constructor;
+ }
+ }
+
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/CustomBeanImplementationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/CustomBeanImplementationTest.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/definition/bean/custom/CustomBeanImplementationTest.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -16,10 +16,10 @@
*/
package org.jboss.jsr299.tck.tests.definition.bean.custom;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.test.audit.annotations.SpecAssertion;
import org.jboss.test.audit.annotations.SpecAssertions;
import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.testharness.impl.packaging.Artifact;
import org.testng.annotations.Test;
@@ -46,9 +46,8 @@
assert CatBean.bean.isGetStereotypesCalled();
}
- @Test(groups={"ri-broken"})
+ @Test
@SpecAssertion(section="5.2", id="k")
- //WBRI-328
public void testIsPolicyCalled() {
assert CatBean.bean.isPolicyCalled();
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/annotated/AlternativeMetaDataTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/annotated/AlternativeMetaDataTest.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/annotated/AlternativeMetaDataTest.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -40,7 +40,7 @@
@SpecVersion("20090625")
public class AlternativeMetaDataTest extends AbstractJSR299Test
{
- @Test(groups = "ri-broken")
+ @Test
@SpecAssertion(section = "11.4", id = "c")
public void testBaseType()
{
@@ -48,7 +48,7 @@
assert annotatedType.getBaseType().equals(DogHouse.class);
}
- @Test(groups = "ri-broken")
+ @Test
@SpecAssertion(section = "11.4", id = "d")
public void testTypeClosure()
{
@@ -60,7 +60,7 @@
assert annotatedType.getTypeClosure().contains(ClassD.class);
}
- @Test(groups = "ri-broken")
+ @Test
@SpecAssertion(section = "11.4", id = "e")
public void testGetAnnotation()
{
@@ -69,22 +69,21 @@
assert annotatedType.getAnnotation(ApplicationScoped.class) == null;
}
- @Test(groups = "ri-broken")
+ @Test
@SpecAssertion(section = "11.4", id = "f")
public void testGetAnnotations()
{
AnnotatedType<?> annotatedType = getCurrentManager().createAnnotatedType(ClassD.class);
assert annotatedType.getAnnotations().size() == 2;
- assert annotatedType.getAnnotations().contains(RequestScoped.class);
- assert annotatedType.getAnnotations().contains(Tame.class);
+ assert annotationSetMatches(annotatedType.getAnnotations(), RequestScoped.class, Tame.class);
}
- @Test(groups = "ri-broken")
+ @Test
@SpecAssertion(section = "11.4", id = "g")
public void testIsAnnotationPresent()
{
AnnotatedType<?> annotatedType = getCurrentManager().createAnnotatedType(ClassD.class);
assert annotatedType.isAnnotationPresent(RequestScoped.class);
- assert annotatedType.isAnnotationPresent(ApplicationScoped.class);
+ assert !annotatedType.isAnnotationPresent(ApplicationScoped.class);
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/BeanManagerTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/BeanManagerTest.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/BeanManagerTest.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -36,7 +36,6 @@
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.InjectionPoint;
-import javax.enterprise.inject.spi.InjectionTarget;
import javax.enterprise.inject.spi.PassivationCapable;
import javax.enterprise.inject.stereotype.Stereotype;
@@ -171,7 +170,7 @@
assert getCurrentManager().getELResolver() != null;
}
- @Test(groups = "ri-broken")
+ @Test
@SpecAssertion(section = "11.3.17", id = "a")
public void testObtainingAnnotatedType()
{
@@ -183,7 +182,7 @@
assert annotatedType.getTypeClosure().size() == 3;
}
- @Test(groups = "ri-broken")
+ @Test
@SpecAssertion(section = "11.3.18", id = "aa")
public void testObtainingInjectionTarget()
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -14,8 +14,6 @@
import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.jsr299.tck.impl.MockCreationalContext;
-import org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle.Important;
-import org.jboss.jsr299.tck.tests.implementation.enterprise.lifecycle.KleinStadt;
import org.jboss.test.audit.annotations.SpecAssertion;
import org.jboss.test.audit.annotations.SpecAssertions;
import org.jboss.test.audit.annotations.SpecVersion;
@@ -37,8 +35,7 @@
@SpecAssertion(section = "3.1.4.2", id = "b"),
@SpecAssertion(section = "3.1.4.2", id = "c"),
@SpecAssertion(section = "2.3.5", id = "d"),
- @SpecAssertion(section = "5.6.3", id = "a"),
- @SpecAssertion(section = "3.9")
+ @SpecAssertion(section = "5.6.3", id = "a")
})
public void testInjectionOfParametersIntoBeanConstructor()
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/byname/duplicateNameResolution/DuplicateNameResolutionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/byname/duplicateNameResolution/DuplicateNameResolutionTest.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/byname/duplicateNameResolution/DuplicateNameResolutionTest.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -17,10 +17,10 @@
package org.jboss.jsr299.tck.tests.lookup.byname.duplicateNameResolution;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecVersion;
import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.jsr299.tck.DeploymentError;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecVersion;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
import org.testng.annotations.Test;
@@ -31,9 +31,8 @@
public class DuplicateNameResolutionTest extends AbstractJSR299Test
{
- @Test(groups = { "resolution", "el", "ri-broken" })
+ @Test(groups = { "resolution", "el"})
@SpecAssertion(section = "5.4.1", id = "da")
- // See WBRI-304
public void testDuplicateNamedBeans() throws Exception
{
assert false;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/InjectionTest.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -40,23 +40,4 @@
assert henHouse.fox.getName().equals("gavin");
}
- @Test(groups = {"injection", "underInvestigation"})
- // @SpecAssertion(section = "3.7", id = "aa")
- @SpecAssertion(section = "review", id = "review")
- // Looks like this got removed from the spec PLM
- public void testInjectingStaticField()
- {
- assert getBeans(BeanWithStaticBoundField_Broken.class).size() == 1;
- assert getInstanceByType(BeanWithStaticBoundField_Broken.class).tuna == null;
- }
-
- @Test(groups = {"injection", "underInvestigation"})
- // @SpecAssertion(section = "3.7", id = "ab")
- // Looks like this got removed from the spec PLM
- public void testInjectingFinalField()
- {
- assert getBeans(BeanWithFinalBoundField_Broken.class).size() == 1;
- assert getInstanceByType(BeanWithFinalBoundField_Broken.class).tuna == null;
- }
-
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java 2009-08-09 21:37:39 UTC (rev 3413)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injectionpoint/InjectionPointTest.java 2009-08-09 21:50:07 UTC (rev 3414)
@@ -132,9 +132,8 @@
assert beanWithInjectionPoint.getInjectedMetadata().getBindings().contains(new CurrentLiteral());
}
- @Test(groups = { "injectionPoint", "ri-broken" })
+ @Test(groups = { "injectionPoint" })
@SpecAssertion(section = "5.6.9", id = "daa")
- // WBRI-309
public void testGetAnnotatedField()
{
// Get an instance of the bean which has another bean injected into it
@@ -145,9 +144,8 @@
assert beanWithInjectionPoint.getInjectedMetadata().getAnnotated().isAnnotationPresent(AnimalStereotype.class);
}
- @Test(groups = { "injectionPoint", "ri-broken" })
+ @Test(groups = { "injectionPoint" })
@SpecAssertion(section = "5.6.9", id = "daa")
- // WBRI-309
public void testGetAnnotatedParameter()
{
// Get an instance of the bean which has another bean injected into it
Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml 2009-08-09 21:37:39 UTC (rev 3413)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml 2009-08-09 21:50:07 UTC (rev 3414)
@@ -3397,17 +3397,57 @@
<text>Invocations of initializer methods by the container are not business method invocations.</text>
</assertion>
- <assertion id="i">
+ <group>
<text>Invocations of producer, disposer and observer methods by the container are business method invocations are are intercepted by method interceptors and decorators.</text>
- </assertion>
+
+ <assertion id="ia">
+ <text>Verify producer methods are intercepted</text>
+ </assertion>
+
+ <assertion id="ib">
+ <text>Verify producer methods are decorated</text>
+ </assertion>
+
+ <assertion id="ic">
+ <text>Verify disposer methods are intercepted</text>
+ </assertion>
+
+ <assertion id="id">
+ <text>Verify disposer methods are decorated</text>
+ </assertion>
+
+ <assertion id="ie">
+ <text>Verify observer methods are intercepted</text>
+ </assertion>
+
+ <assertion id="if">
+ <text>Verify observer methods are decorated</text>
+ </assertion>
+ </group>
+
<assertion id="j">
<text>Invocation of lifecycle callbacks by the container are not business method invocations, but are intercepted by interceptors for lifecycle callbacks.</text>
</assertion>
- <assertion id="k">
+ <group>
<text>Invocations of interceptors and decorator methods during method or lifecycle callback interception are not business method invocations, and therefore no recursive interception occurs.</text>
- </assertion>
+ <assertion id="ka">
+ <text>Verify decorators callbacks are not intercepted</text>
+ </assertion>
+
+ <assertion id="kb">
+ <text>Verify decorators callbacks are not decorated</text>
+ </assertion>
+
+ <assertion id="kc">
+ <text>Verify interceptor callbacks are not intercepted</text>
+ </assertion>
+
+ <assertion id="kd">
+ <text>Verify interceptor callbacks are not decorated</text>
+ </assertion>
+ </group>
</section>
<section id="7.3" title="Lifecycle of contextual instances">
15 years, 4 months
[webbeans-commits] Webbeans SVN: r3413 - ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-09 17:37:39 -0400 (Sun, 09 Aug 2009)
New Revision: 3413
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/NonNormalScopeTest.java
Log:
minor
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/NonNormalScopeTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/NonNormalScopeTest.java 2009-08-09 21:30:35 UTC (rev 3412)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/activities/current/NonNormalScopeTest.java 2009-08-09 21:37:39 UTC (rev 3413)
@@ -12,11 +12,6 @@
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;
-/**
- *
- * Spec version: 20090519
- *
- */
@Artifact
public class NonNormalScopeTest extends AbstractWebBeansTest
{
15 years, 4 months
[webbeans-commits] Webbeans SVN: r3412 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-09 17:30:35 -0400 (Sun, 09 Aug 2009)
New Revision: 3412
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanICTest.java
Log:
remove out of date test
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanICTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanICTest.java 2009-08-09 21:29:29 UTC (rev 3411)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/NewEnterpriseBeanICTest.java 2009-08-09 21:30:35 UTC (rev 3412)
@@ -6,10 +6,10 @@
import javax.enterprise.inject.AnnotationLiteral;
import javax.enterprise.inject.spi.Bean;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecVersion;
import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.jsr299.tck.literals.NewLiteral;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecVersion;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.IntegrationTest;
import org.jboss.testharness.impl.packaging.Packaging;
@@ -51,18 +51,6 @@
assert theOnlyLitter.getQuantity() == fox.getNextLitterSize();
}
- @Test(groups = { "new", "ri-broken" })
- @SpecAssertion(section = "3.10", id = "w")
- // WBRI-208
- public void testNewBeanHasNoProducerFields() throws Exception
- {
- FoxLocal fox = getInstanceByType(FoxLocal.class);
- FoxLocal newFox = getInstanceByType(FoxLocal.class,new NewLiteral());
- newFox.setDen(new Den("NewFoxDen"));
- Den theOnlyDen = getInstanceByType(Den.class,new AnnotationLiteral<Tame>(){});
- assert theOnlyDen.getName().equals(fox.getDen().getName());
- }
-
@Test(groups = { "new", "disposal" })
@SpecAssertion(section = "3.10", id = "x")
public void testNewBeanHasNoDisposalMethods() throws Exception
15 years, 4 months
[webbeans-commits] Webbeans SVN: r3410 - ri/trunk/api/src/main/java/javax/enterprise/inject/spi.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-09 17:29:04 -0400 (Sun, 09 Aug 2009)
New Revision: 3410
Modified:
ri/trunk/api/src/main/java/javax/enterprise/inject/spi/Producer.java
Log:
formatting
Modified: ri/trunk/api/src/main/java/javax/enterprise/inject/spi/Producer.java
===================================================================
--- ri/trunk/api/src/main/java/javax/enterprise/inject/spi/Producer.java 2009-08-09 10:29:46 UTC (rev 3409)
+++ ri/trunk/api/src/main/java/javax/enterprise/inject/spi/Producer.java 2009-08-09 21:29:04 UTC (rev 3410)
@@ -19,12 +19,13 @@
import java.util.Set;
import javax.enterprise.context.spi.CreationalContext;
+
/**
- * The interface javax.enterprise.inject.spi.Producer provides a generic operation for producing an instance of a type.
-
+ * The interface javax.enterprise.inject.spi.Producer provides a generic
+ * operation for producing an instance of a type.
*
* @author Pete Muir
- *
+ *
* @param <T>
*/
public interface Producer<T>
15 years, 4 months