Author: pete.muir(a)jboss.org
Date: 2009-06-28 11:17:17 -0400 (Sun, 28 Jun 2009)
New Revision: 2914
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/TypeStore.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MetaAnnotationStore.java
Removed:
ri/trunk/core-api/src/main/java/org/jboss/webbeans/Realizes.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedWBClass.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedWBField.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedWBMethod.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedWBParameter.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MetaDataCache.java
ri/trunk/tests/src/test/java/org/jboss/jsr299/tck/tests/inheritance/realization/
Modified:
ri/trunk/api/src/main/java/javax/enterprise/inject/spi/BeforeBeanDiscovery.java
ri/trunk/api/src/main/java/javax/enterprise/inject/stereotype/Stereotype.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/FacadeImpl.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/AbstractProducerBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeBeanDiscoveryImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventObserver.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolvableWBClass.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotationStore.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/MergedStereotypes.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/resources/ClassTransformer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/context/PassivatingContextTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/AnimalOrderStereotype.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/AnimalStereotype.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/RequestScopedAnimalStereotype.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/StereotypesTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/ClassAnnotatedItemTest.java
Log:
Remove realization, remove stereotype requirements, impl BeforeBeanDiscovery
Modified: ri/trunk/api/src/main/java/javax/enterprise/inject/spi/BeforeBeanDiscovery.java
===================================================================
---
ri/trunk/api/src/main/java/javax/enterprise/inject/spi/BeforeBeanDiscovery.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/api/src/main/java/javax/enterprise/inject/spi/BeforeBeanDiscovery.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -32,4 +32,6 @@
public void addStereotype(Class<? extends Annotation> stereotype, Annotation...
stereotypeDef);
public void addInterceptorBindingType(Class<? extends Annotation> bindingType);
+
+ public void addAnnotatedType(AnnotatedType<?> type);
}
Modified: ri/trunk/api/src/main/java/javax/enterprise/inject/stereotype/Stereotype.java
===================================================================
---
ri/trunk/api/src/main/java/javax/enterprise/inject/stereotype/Stereotype.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/api/src/main/java/javax/enterprise/inject/stereotype/Stereotype.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -20,7 +20,6 @@
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@@ -35,21 +34,4 @@
@Retention(RUNTIME)
@Target(ANNOTATION_TYPE)
@Documented
-public @interface Stereotype
-{
-
- /**
- * Restrict the scope of the stereotyped bean
- *
- * @return the allowed scopes
- */
- public Class<? extends Annotation>[] supportedScopes() default {};
-
- /**
- * Require that stereotype beans have certain API types
- *
- * @return the required types
- */
- public Class<?>[] requiredTypes() default {};
-
-}
+public @interface Stereotype {}
Deleted: ri/trunk/core-api/src/main/java/org/jboss/webbeans/Realizes.java
===================================================================
--- ri/trunk/core-api/src/main/java/org/jboss/webbeans/Realizes.java 2009-06-28 15:05:58
UTC (rev 2913)
+++ ri/trunk/core-api/src/main/java/org/jboss/webbeans/Realizes.java 2009-06-28 15:17:17
UTC (rev 2914)
@@ -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;
-
-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;
-
-/**
- * Specifies that an implementation class directly specializes its superclass,
- * of that a producer method directly specializes the method it overrides.
- *
- * @author Gavin King
- * @author Pete Muir
- */
-
-@Target(TYPE)
-@Retention(RUNTIME)
-@Documented
-public @interface Realizes
-{
-}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-06-28
15:05:58 UTC (rev 2913)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -86,7 +86,7 @@
import org.jboss.webbeans.log.Log;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.manager.api.WebBeansManager;
-import org.jboss.webbeans.metadata.cache.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaAnnotationStore;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.Proxies;
import org.jboss.webbeans.util.Reflections;
@@ -359,7 +359,7 @@
Class<?> clazz = event.getClass();
for (Annotation annotation : bindings)
{
- if
(!getServices().get(MetaDataCache.class).getBindingTypeModel(annotation.annotationType()).isValid())
+ if
(!getServices().get(MetaAnnotationStore.class).getBindingTypeModel(annotation.annotationType()).isValid())
{
throw new IllegalArgumentException("Not a binding type " +
annotation);
}
@@ -463,7 +463,7 @@
{
for (Annotation annotation : element.getAnnotations())
{
- if
(!getServices().get(MetaDataCache.class).getBindingTypeModel(annotation.annotationType()).isValid())
+ if
(!getServices().get(MetaAnnotationStore.class).getBindingTypeModel(annotation.annotationType()).isValid())
{
throw new IllegalArgumentException("Not a binding type " +
annotation);
}
@@ -704,7 +704,7 @@
{
creationalContext = ((CreationalContextImpl<?>)
creationalContext).getCreationalContext(bean);
}
- if
(getServices().get(MetaDataCache.class).getScopeModel(bean.getScopeType()).isNormal())
+ if
(getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScopeType()).isNormal())
{
if (creationalContext != null || (creationalContext == null &&
getContext(bean.getScopeType()).get(bean) != null))
{
@@ -742,7 +742,7 @@
}
WBAnnotated<?, ?> element = ResolvableWBClass.of(injectionPoint.getType(),
injectionPoint.getBindings().toArray(new Annotation[0]), this);
Bean<?> resolvedBean = getBean(element, element.getBindingsAsArray());
- if
(getServices().get(MetaDataCache.class).getScopeModel(resolvedBean.getScopeType()).isNormal()
&& !Proxies.isTypeProxyable(injectionPoint.getType()))
+ if
(getServices().get(MetaAnnotationStore.class).getScopeModel(resolvedBean.getScopeType()).isNormal()
&& !Proxies.isTypeProxyable(injectionPoint.getType()))
{
throw new UnproxyableResolutionException("Attempting to inject an
unproxyable normal scoped bean " + resolvedBean + " into " +
injectionPoint);
}
@@ -802,7 +802,7 @@
throw new AmbiguousResolutionException(element + "Resolved multiple Web
Beans");
}
Bean<T> bean = (Bean<T>) beans.iterator().next();
- boolean normalScoped =
getServices().get(MetaDataCache.class).getScopeModel(bean.getScopeType()).isNormal();
+ boolean normalScoped =
getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScopeType()).isNormal();
if (normalScoped && !Beans.isBeanProxyable(bean))
{
throw new UnproxyableResolutionException("Normal scoped bean " + bean
+ " is not proxyable");
@@ -890,7 +890,7 @@
public BeanManagerImpl setCurrent(Class<? extends Annotation> scopeType)
{
- if (!getServices().get(MetaDataCache.class).getScopeModel(scopeType).isNormal())
+ if
(!getServices().get(MetaAnnotationStore.class).getScopeModel(scopeType).isNormal())
{
throw new IllegalArgumentException("Scope must be a normal scope type
" + scopeType);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/FacadeImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/FacadeImpl.java 2009-06-28 15:05:58 UTC
(rev 2913)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/FacadeImpl.java 2009-06-28 15:17:17 UTC
(rev 2914)
@@ -24,7 +24,7 @@
import java.util.HashSet;
import java.util.Set;
-import org.jboss.webbeans.metadata.cache.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaAnnotationStore;
/**
* Common implementation for binding-type-based helpers
@@ -77,7 +77,7 @@
result.addAll(bindings);
for (Annotation newAnnotation : newBindings)
{
- if
(!getManager().getServices().get(MetaDataCache.class).getBindingTypeModel(newAnnotation.annotationType()).isValid())
+ if
(!getManager().getServices().get(MetaAnnotationStore.class).getBindingTypeModel(newAnnotation.annotationType()).isValid())
{
throw new IllegalArgumentException(newAnnotation + " is not a binding
for " + this);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-06-28 15:05:58 UTC
(rev 2913)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-06-28 15:17:17 UTC
(rev 2914)
@@ -48,7 +48,7 @@
import org.jboss.webbeans.bootstrap.api.Service;
import org.jboss.webbeans.injection.resolution.ResolvableWBClass;
import org.jboss.webbeans.introspector.WBAnnotated;
-import org.jboss.webbeans.metadata.cache.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaAnnotationStore;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.ListComparator;
import org.jboss.webbeans.util.Names;
@@ -70,7 +70,7 @@
{
validateInjectionPoint(ij, beanManager);
}
- boolean normalScoped =
beanManager.getServices().get(MetaDataCache.class).getScopeModel(bean.getScopeType()).isNormal();
+ boolean normalScoped =
beanManager.getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScopeType()).isNormal();
if (normalScoped && !Beans.isBeanProxyable(bean))
{
throw new UnproxyableResolutionException("Normal scoped bean " + bean
+ " is not proxyable");
@@ -158,7 +158,7 @@
throw new AmbiguousResolutionException("The injection point " + ij +
" with binding types " + Names.annotationsToString(ij.getBindings()) + " in
" + ij.getBean() + " has ambiguous dependencies");
}
Bean<?> resolvedBean = (Bean<?>) resolvedBeans.iterator().next();
- if
(beanManager.getServices().get(MetaDataCache.class).getScopeModel(resolvedBean.getScopeType()).isNormal()
&& !Proxies.isTypeProxyable(ij.getType()))
+ if
(beanManager.getServices().get(MetaAnnotationStore.class).getScopeModel(resolvedBean.getScopeType()).isNormal()
&& !Proxies.isTypeProxyable(ij.getType()))
{
throw new UnproxyableResolutionException("The injection point " + ij +
" has non-proxyable dependencies");
}
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-06-28
15:05:58 UTC (rev 2913)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -47,7 +47,7 @@
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.metadata.cache.MergedStereotypes;
-import org.jboss.webbeans.metadata.cache.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaAnnotationStore;
import org.jboss.webbeans.util.Reflections;
/**
@@ -292,7 +292,7 @@
private boolean checkInjectionPointsAreSerializable()
{
- boolean passivating =
manager.getServices().get(MetaDataCache.class).getScopeModel(this.getScopeType()).isPassivating();
+ boolean passivating =
manager.getServices().get(MetaAnnotationStore.class).getScopeModel(this.getScopeType()).isPassivating();
for (WBInjectionPoint<?, ?> injectionPoint : getAnnotatedInjectionPoints())
{
Annotation[] bindings =
injectionPoint.getMetaAnnotationsAsArray(BindingType.class);
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-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -45,7 +45,7 @@
import org.jboss.webbeans.introspector.WBMember;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.metadata.cache.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaAnnotationStore;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Reflections;
@@ -206,7 +206,7 @@
{
throw new IllegalProductException("Cannot return null from a non-dependent
producer method");
}
- boolean passivating =
manager.getServices().get(MetaDataCache.class).getScopeModel(getScopeType()).isPassivating();
+ boolean passivating =
manager.getServices().get(MetaAnnotationStore.class).getScopeModel(getScopeType()).isPassivating();
if (passivating && !Reflections.isSerializable(instance.getClass()))
{
throw new IllegalProductException("Producers cannot declare passivating
scope and return a non-serializable class");
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-06-28
15:05:58 UTC (rev 2913)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -44,7 +44,7 @@
import org.jboss.webbeans.introspector.WBParameter;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.metadata.cache.MetaDataCache;
+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;
@@ -335,7 +335,7 @@
{
throw new DefinitionException("Simple bean " + type + " cannot be
a parameterized type");
}
- boolean passivating =
manager.getServices().get(MetaDataCache.class).getScopeModel(scopeType).isPassivating();
+ boolean passivating =
manager.getServices().get(MetaAnnotationStore.class).getScopeModel(scopeType).isPassivating();
if (passivating && !_serializable)
{
throw new DefinitionException("Simple bean declaring a passivating scope
must have a serializable implementation class " + toString());
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-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -16,18 +16,14 @@
*/
package org.jboss.webbeans.bootstrap;
-import java.lang.annotation.Annotation;
import java.util.Set;
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.deployment.DeploymentType;
import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.Realizes;
import org.jboss.webbeans.bean.AbstractClassBean;
import org.jboss.webbeans.bean.DecoratorBean;
import org.jboss.webbeans.bean.DisposalMethodBean;
@@ -44,8 +40,6 @@
import org.jboss.webbeans.introspector.WBClass;
import org.jboss.webbeans.introspector.WBField;
import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.introspector.WrappedWBField;
-import org.jboss.webbeans.introspector.WrappedWBMethod;
import org.jboss.webbeans.jsf.JsfApiAbstraction;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -121,13 +115,6 @@
createObserverMethods(bean, bean.getAnnotatedItem());
createDisposalMethods(bean, bean.getAnnotatedItem());
- if (bean.getAnnotatedItem().isAnnotationPresent(Realizes.class))
- {
- createRealizedProducerMethods(bean, bean.getAnnotatedItem());
- createRealizedProducerFields(bean, bean.getAnnotatedItem());
- createRealizedObserverMethods(bean, bean.getAnnotatedItem());
- }
-
}
protected void createProducerMethods(AbstractClassBean<?> declaringBean,
WBClass<?> annotatedClass)
@@ -154,24 +141,6 @@
manager.getResolver().addInjectionPoints(bean.getAnnotatedInjectionPoints());
}
- protected void createRealizedProducerMethods(AbstractClassBean<?> declaringBean,
WBClass<?> realizingClass)
- {
- WBClass<?> realizedClass = realizingClass.getSuperclass();
- for (WBMethod<?> realizedMethod :
realizedClass.getDeclaredAnnotatedMethods(Produces.class))
- {
- createProducerMethod(declaringBean, realizeProducerMethod(realizedMethod,
realizingClass));
- }
- }
-
- protected void createRealizedProducerFields(AbstractClassBean<?> declaringBean,
WBClass<?> realizingClass)
- {
- WBClass<?> realizedClass = realizingClass.getSuperclass();
- for (final WBField<?> realizedField :
realizedClass.getDeclaredAnnotatedFields(Produces.class))
- {
- createProducerField(declaringBean, realizeProducerField(realizedField,
realizingClass));
- }
- }
-
protected <T> void createProducerField(AbstractClassBean<?> declaringBean,
WBField<T> field)
{
ProducerFieldBean<T> bean = ProducerFieldBean.of(field, declaringBean,
manager);
@@ -194,11 +163,6 @@
}
}
- protected void createRealizedObserverMethods(AbstractClassBean<?> declaringBean,
WBClass<?> realizingClass)
- {
- createObserverMethods(declaringBean, realizingClass.getSuperclass());
- }
-
protected void createObserverMethod(RIBean<?> declaringBean, WBMethod<?>
method)
{
ObserverImpl<?> observer = ObserverFactory.create(method, declaringBean,
manager);
@@ -257,75 +221,7 @@
{
return type.getNoArgsConstructor() != null ||
type.getAnnotatedConstructors(Initializer.class).size() > 0;
}
-
- private static <T> WBMethod<T> realizeProducerMethod(final
WBMethod<T> method, final WBClass<?> realizingClass)
- {
- return new WrappedWBMethod<T>(method,
realizingClass.getMetaAnnotations(BindingType.class))
- {
-
- @Override
- public Set<Annotation> getMetaAnnotations(Class<? extends
Annotation> metaAnnotationType)
- {
- if (metaAnnotationType.equals(DeploymentType.class))
- {
- return realizingClass.getMetaAnnotations(DeploymentType.class);
- }
- else
- {
- return super.getMetaAnnotations(metaAnnotationType);
- }
- }
-
- @Override
- public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends
Annotation> metaAnnotationType)
- {
- if (metaAnnotationType.equals(DeploymentType.class))
- {
- return realizingClass.getDeclaredMetaAnnotations(DeploymentType.class);
- }
- else
- {
- return super.getDeclaredMetaAnnotations(metaAnnotationType);
- }
- }
-
- };
- }
-
- private static <T> WBField<T> realizeProducerField(final WBField<T>
field, final WBClass<?> realizingClass)
- {
- return new WrappedWBField<T>(field,
realizingClass.getMetaAnnotations(BindingType.class))
- {
-
- @Override
- public Set<Annotation> getMetaAnnotations(Class<? extends
Annotation> metaAnnotationType)
- {
- if (metaAnnotationType.equals(DeploymentType.class))
- {
- return realizingClass.getMetaAnnotations(DeploymentType.class);
- }
- else
- {
- return super.getMetaAnnotations(metaAnnotationType);
- }
- }
-
- @Override
- public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends
Annotation> metaAnnotationType)
- {
- if (metaAnnotationType.equals(DeploymentType.class))
- {
- return realizingClass.getDeclaredMetaAnnotations(DeploymentType.class);
- }
- else
- {
- return super.getDeclaredMetaAnnotations(metaAnnotationType);
- }
- }
-
- };
- }
-
+
public BeanDeployerEnvironment getBeanDeployerEnvironment()
{
return environment;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-06-28
15:05:58 UTC (rev 2913)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -21,6 +21,7 @@
import java.util.Set;
import javax.decorator.Decorator;
+import javax.enterprise.inject.spi.AnnotatedType;
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.bean.RIBean;
@@ -65,6 +66,16 @@
}
return this;
}
+
+ public AbstractBeanDeployer addClass(AnnotatedType<?> clazz)
+ {
+ ClassTransformer classTransformer =
getManager().getServices().get(ClassTransformer.class);
+ if (!clazz.getJavaClass().isAnnotation() &&
!clazz.getJavaClass().isEnum())
+ {
+ classes.add(classTransformer.loadClass(clazz));
+ }
+ return this;
+ }
public AbstractBeanDeployer addClasses(Iterable<Class<?>> classes)
{
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeBeanDiscoveryImpl.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeBeanDiscoveryImpl.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeBeanDiscoveryImpl.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -2,31 +2,52 @@
import java.lang.annotation.Annotation;
+import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.literal.BindingTypeLiteral;
+import org.jboss.webbeans.literal.InterceptorBindingTypeLiteral;
+import org.jboss.webbeans.literal.ScopeTypeLiteral;
+import org.jboss.webbeans.metadata.TypeStore;
+
public class BeforeBeanDiscoveryImpl implements BeforeBeanDiscovery
{
+
+ private final TypeStore typeStore;
+ private final BeanDeployer beanDeployer;
+
+ public BeforeBeanDiscoveryImpl(BeanManagerImpl manager, BeanDeployer beanDeployer)
+ {
+ this.typeStore = manager.getServices().get(TypeStore.class);
+ this.beanDeployer = beanDeployer;
+ }
public void addBindingType(Class<? extends Annotation> bindingType)
{
-
+ typeStore.add(bindingType, new BindingTypeLiteral());
}
public void addInterceptorBindingType(Class<? extends Annotation> bindingType)
{
- throw new RuntimeException("Not Yet Implemented");
+ typeStore.add(bindingType, new InterceptorBindingTypeLiteral());
}
public void addScopeType(Class<? extends Annotation> scopeType,
boolean normal, boolean passivating)
{
- throw new RuntimeException("Not Yet Implemented");
+ typeStore.add(scopeType, new ScopeTypeLiteral(normal, passivating));
}
public void addStereotype(Class<? extends Annotation> stereotype,
Annotation... stereotypeDef)
{
- throw new RuntimeException("Not Yet Implemented");
+ throw new UnsupportedOperationException();
}
+
+ public void addAnnotatedType(AnnotatedType<?> type)
+ {
+ beanDeployer.addClass(type);
+ }
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -51,7 +51,8 @@
import org.jboss.webbeans.log.Log;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.messaging.spi.JmsServices;
-import org.jboss.webbeans.metadata.cache.MetaDataCache;
+import org.jboss.webbeans.metadata.TypeStore;
+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.ClassTransformer;
@@ -134,9 +135,10 @@
getServices().add(ServletApiAbstraction.class, new
ServletApiAbstraction(resourceLoader));
// Temporary workaround to provide context for building annotated class
// TODO expose AnnotatedClass on SPI and allow container to provide impl of this
via ResourceLoader
- getServices().add(ClassTransformer.class, new ClassTransformer());
- getServices().add(MetaDataCache.class, new
MetaDataCache(getServices().get(ClassTransformer.class)));
getServices().add(Validator.class, new Validator());
+ getServices().add(TypeStore.class, new TypeStore());
+ getServices().add(ClassTransformer.class, new
ClassTransformer(getServices().get(TypeStore.class)));
+ getServices().add(MetaAnnotationStore.class, new
MetaAnnotationStore(getServices().get(ClassTransformer.class)));
}
public BeanManagerImpl getManager()
@@ -207,7 +209,7 @@
BeanDeployer beanDeployer = new BeanDeployer(manager, ejbDescriptors);
- fireBeforeBeanDiscoveryEvent();
+ fireBeforeBeanDiscoveryEvent(beanDeployer);
registerBeans(getServices().get(WebBeanDiscovery.class).discoverWebBeanClasses(),
beanDeployer);
fireAfterBeanDiscoveryEvent();
log.debug("Web Beans initialized. Validating beans.");
@@ -241,12 +243,12 @@
log.debug("Enabled interceptor types: " +
manager.getEnabledInterceptorClasses());
}
- private void fireBeforeBeanDiscoveryEvent()
+ private void fireBeforeBeanDiscoveryEvent(BeanDeployer beanDeployer)
{
- BeforeBeanDiscoveryImpl event = new BeforeBeanDiscoveryImpl();
+ BeforeBeanDiscoveryImpl event = new BeforeBeanDiscoveryImpl(getManager(),
beanDeployer);
try
{
- manager.fireEvent(event);
+ getManager().fireEvent(event);
}
catch (Exception e)
{
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventObserver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventObserver.java 2009-06-28
15:05:58 UTC (rev 2913)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventObserver.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -25,7 +25,7 @@
import javax.enterprise.inject.Current;
import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.metadata.cache.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaAnnotationStore;
import org.jboss.webbeans.util.Reflections;
import org.jboss.webbeans.util.Strings;
@@ -140,7 +140,7 @@
boolean found = false;
for (Annotation y : bindings)
{
- if
(manager.getServices().get(MetaDataCache.class).getBindingTypeModel(x.annotationType()).isEqual(x,
y))
+ if
(manager.getServices().get(MetaAnnotationStore.class).getBindingTypeModel(x.annotationType()).isEqual(x,
y))
{
found = true;
}
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolvableWBClass.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolvableWBClass.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/resolution/ResolvableWBClass.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -35,6 +35,7 @@
import org.jboss.webbeans.introspector.AnnotationStore;
import org.jboss.webbeans.introspector.WBAnnotated;
import org.jboss.webbeans.introspector.jlr.AbstractWBAnnotated;
+import org.jboss.webbeans.metadata.TypeStore;
import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Reflections;
@@ -128,12 +129,12 @@
private ResolvableWBClass(Type type, Annotation[] annotations, BeanManagerImpl
manager)
{
- this(type, AnnotationStore.of(annotations, EMPTY_ANNOTATION_ARRAY), manager);
+ this(type, AnnotationStore.of(annotations, EMPTY_ANNOTATION_ARRAY,
manager.getServices().get(TypeStore.class)), manager);
}
private ResolvableWBClass(Type type, Set<Annotation>annotations, BeanManagerImpl
manager)
{
- this(type, AnnotationStore.of(annotations, EMPTY_ANNOTATION_SET), manager);
+ this(type, AnnotationStore.of(annotations, EMPTY_ANNOTATION_SET,
manager.getServices().get(TypeStore.class)), manager);
}
@Override
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotationStore.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotationStore.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotationStore.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -30,6 +30,7 @@
import javax.enterprise.inject.BindingType;
import org.jboss.webbeans.literal.CurrentLiteral;
+import org.jboss.webbeans.metadata.TypeStore;
import org.jboss.webbeans.util.collections.multi.SetHashMultiMap;
import org.jboss.webbeans.util.collections.multi.SetMultiMap;
@@ -81,22 +82,22 @@
* @param annotatedElement
* @return
*/
- public static AnnotationStore of(AnnotatedElement annotatedElement)
+ public static AnnotationStore of(AnnotatedElement annotatedElement, TypeStore
typeStore)
{
- return new AnnotationStore(buildAnnotationMap(annotatedElement.getAnnotations()),
buildAnnotationMap(annotatedElement.getDeclaredAnnotations()));
+ return new AnnotationStore(buildAnnotationMap(annotatedElement.getAnnotations()),
buildAnnotationMap(annotatedElement.getDeclaredAnnotations()), typeStore);
}
- public static AnnotationStore of(Annotation[] annotations, Annotation[]
declaredAnnotations)
+ public static AnnotationStore of(Annotation[] annotations, Annotation[]
declaredAnnotations, TypeStore typeStore)
{
- return new AnnotationStore(buildAnnotationMap(annotations),
buildAnnotationMap(declaredAnnotations));
+ return new AnnotationStore(buildAnnotationMap(annotations),
buildAnnotationMap(declaredAnnotations), typeStore);
}
- public static AnnotationStore of(Set<Annotation> annotations,
Set<Annotation> declaredAnnotations)
+ public static AnnotationStore of(Set<Annotation> annotations,
Set<Annotation> declaredAnnotations, TypeStore typeStore)
{
- return new AnnotationStore(buildAnnotationMap(annotations),
buildAnnotationMap(declaredAnnotations));
+ return new AnnotationStore(buildAnnotationMap(annotations),
buildAnnotationMap(declaredAnnotations), typeStore);
}
- public static AnnotationStore wrap(AnnotationStore annotationStore,
Set<Annotation> annotations, Set<Annotation> declaredAnnotations)
+ public static AnnotationStore wrap(AnnotationStore annotationStore,
Set<Annotation> annotations, Set<Annotation> declaredAnnotations, TypeStore
typeStore)
{
Map<Class<? extends Annotation>, Annotation> annotationMap = new
HashMap<Class<? extends Annotation>, Annotation>();
annotationMap.putAll(buildAnnotationMap(annotations));
@@ -106,7 +107,7 @@
declaredAnnotationMap.putAll(buildAnnotationMap(declaredAnnotations));
declaredAnnotationMap.putAll(annotationStore.getDeclaredAnnotationMap());
- return new AnnotationStore(annotationMap, declaredAnnotationMap);
+ return new AnnotationStore(annotationMap, declaredAnnotationMap, typeStore);
}
// The annotation map (annotation type -> annotation) of the item
@@ -134,7 +135,7 @@
* @param annotationMap A map of annotation to register
*
*/
- protected AnnotationStore(Map<Class<? extends Annotation>, Annotation>
annotationMap, Map<Class<? extends Annotation>, Annotation>
declaredAnnotationMap)
+ protected AnnotationStore(Map<Class<? extends Annotation>, Annotation>
annotationMap, Map<Class<? extends Annotation>, Annotation>
declaredAnnotationMap, TypeStore typeStore)
{
if (annotationMap == null)
{
@@ -145,14 +146,8 @@
this.metaAnnotationMap = new SetHashMultiMap<Class<? extends Annotation>,
Annotation>();
for (Annotation annotation : annotationMap.values())
{
- for (Annotation metaAnnotation : annotation.annotationType().getAnnotations())
- {
- // Only map meta-annotations we are interested in
- if (MAPPED_METAANNOTATIONS.contains(metaAnnotation.annotationType()))
- {
- metaAnnotationMap.put(metaAnnotation.annotationType(), annotation);
- }
- }
+ addMetaAnnotations(metaAnnotationMap, annotation,
annotation.annotationType().getAnnotations());
+ addMetaAnnotations(metaAnnotationMap, annotation,
typeStore.get(annotation.annotationType()));
annotationSet.add(annotation);
}
@@ -163,20 +158,39 @@
this.declaredAnnotationMap = declaredAnnotationMap;
this.declaredAnnotationSet = new HashSet<Annotation>();
this.declaredMetaAnnotationMap = new SetHashMultiMap<Class<? extends
Annotation>, Annotation>();
- for (Annotation annotation : declaredAnnotationMap.values())
+ for (Annotation declaredAnnotation : declaredAnnotationMap.values())
{
- for (Annotation metaAnnotation : annotation.annotationType().getAnnotations())
- {
- // Only map meta-annotations we are interested in
- if (MAPPED_METAANNOTATIONS.contains(metaAnnotation.annotationType()))
- {
- declaredMetaAnnotationMap.put(metaAnnotation.annotationType(),
annotation);
- }
- }
- declaredAnnotationSet.add(annotation);
+ addMetaAnnotations(declaredMetaAnnotationMap, declaredAnnotation,
declaredAnnotation.annotationType().getAnnotations());
+ addMetaAnnotations(declaredMetaAnnotationMap, declaredAnnotation,
typeStore.get(declaredAnnotation.annotationType()));
+ declaredAnnotationSet.add(declaredAnnotation);
}
}
+ private static void addMetaAnnotations(SetMultiMap<Class<? extends
Annotation>, Annotation> metaAnnotationMap, Annotation annotation, Annotation[]
metaAnnotations)
+ {
+ for (Annotation metaAnnotation : metaAnnotations)
+ {
+ addMetaAnnotation(metaAnnotationMap, annotation,
metaAnnotation.annotationType());
+ }
+ }
+
+ private static void addMetaAnnotations(SetMultiMap<Class<? extends
Annotation>, Annotation> metaAnnotationMap, Annotation annotation,
Iterable<Annotation> metaAnnotations)
+ {
+ for (Annotation metaAnnotation : metaAnnotations)
+ {
+ addMetaAnnotation(metaAnnotationMap, annotation,
metaAnnotation.annotationType());
+ }
+ }
+
+ private static void addMetaAnnotation(SetMultiMap<Class<? extends
Annotation>, Annotation> metaAnnotationMap, Annotation annotation, Class<?
extends Annotation> metaAnnotationType)
+ {
+ // Only map meta-annotations we are interested in
+ if (MAPPED_METAANNOTATIONS.contains(metaAnnotationType))
+ {
+ metaAnnotationMap.put(metaAnnotationType, annotation);
+ }
+ }
+
public Set<Annotation> getAnnotations()
{
return Collections.unmodifiableSet(annotationSet);
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedWBClass.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedWBClass.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedWBClass.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -1,88 +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;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-public class WrappedWBClass<T> extends ForwardingWBClass<T>
-{
-
- private final WBClass<T> delegate;
- private AnnotationStore annotationStore;
-
- public WrappedWBClass(WBClass<T> clazz, Set<Annotation> extraAnnotations,
Set<Annotation> extraDeclaredAnnotations)
- {
- this.delegate = clazz;
- this.annotationStore = AnnotationStore.wrap(clazz.getAnnotationStore(),
extraAnnotations, extraDeclaredAnnotations);
- }
-
- @Override
- protected WBClass<T> delegate()
- {
- return delegate;
- }
-
- @Override
- public AnnotationStore getAnnotationStore()
- {
- return annotationStore;
- }
-
- public <A extends Annotation> A getAnnotation(Class<A> annotationType)
- {
- return getAnnotationStore().getAnnotation(annotationType);
- }
-
- public Set<Annotation> getAnnotations()
- {
- return getAnnotationStore().getAnnotations();
- }
-
- public Set<Annotation> getMetaAnnotations(Class<? extends Annotation>
metaAnnotationType)
- {
- return getAnnotationStore().getMetaAnnotations(metaAnnotationType);
- }
-
- public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation>
metaAnnotationType)
- {
- return getAnnotationStore().getMetaAnnotationsAsArray(metaAnnotationType);
- }
-
- @Deprecated
- public Set<Annotation> getBindings()
- {
- return getAnnotationStore().getBindings();
- }
-
- @Deprecated
- public Annotation[] getBindingsAsArray()
- {
- return getAnnotationStore().getBindingsAsArray();
- }
-
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- {
- return getAnnotationStore().isAnnotationPresent(annotationType);
- }
-
- public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends
Annotation> metaAnnotationType)
- {
- return getAnnotationStore().getDeclaredMetaAnnotations(metaAnnotationType);
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedWBField.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedWBField.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedWBField.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -1,107 +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;
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-public class WrappedWBField<T> extends ForwardingWBField<T>
-{
-
- private final WBField<T> delegate;
- private AnnotationStore annotationStore;
-
- public WrappedWBField(WBField<T> field, Set<Annotation> extraAnnotations)
- {
- this.delegate = field;
- this.annotationStore = AnnotationStore.wrap(field.getAnnotationStore(),
extraAnnotations, extraAnnotations);
- }
-
- @Override
- protected WBField<T> delegate()
- {
- return delegate;
- }
-
- @Override
- public AnnotationStore getAnnotationStore()
- {
- return annotationStore;
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- public <A extends Annotation> A getAnnotation(Class<A> annotationType)
- {
- return getAnnotationStore().getAnnotation(annotationType);
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- public Set<Annotation> getAnnotations()
- {
- return getAnnotationStore().getAnnotations();
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- public Set<Annotation> getMetaAnnotations(Class<? extends Annotation>
metaAnnotationType)
- {
- return getAnnotationStore().getMetaAnnotations(metaAnnotationType);
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation>
metaAnnotationType)
- {
- return getAnnotationStore().getMetaAnnotationsAsArray(metaAnnotationType);
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- @Deprecated
- public Set<Annotation> getBindings()
- {
- return getAnnotationStore().getBindings();
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- @Deprecated
- public Annotation[] getBindingsAsArray()
- {
- return getAnnotationStore().getBindingsAsArray();
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- {
- return getAnnotationStore().isAnnotationPresent(annotationType);
- }
-
- public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends
Annotation> metaAnnotationType)
- {
- return getAnnotationStore().getDeclaredMetaAnnotations(metaAnnotationType);
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedWBMethod.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedWBMethod.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedWBMethod.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -1,109 +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;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-public class WrappedWBMethod<T> extends ForwardingWBMethod<T>
-{
-
- private final WBMethod<T> delegate;
- private AnnotationStore annotationStore;
-
- public WrappedWBMethod(WBMethod<T> method, Set<Annotation>
extraAnnotations)
- {
- this.delegate = method;
- this.annotationStore = AnnotationStore.wrap(method.getAnnotationStore(),
extraAnnotations, extraAnnotations);
- }
-
- @Override
- protected WBMethod<T> delegate()
- {
- return delegate;
- }
-
- @Override
- public AnnotationStore getAnnotationStore()
- {
- return annotationStore;
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- public <A extends Annotation> A getAnnotation(Class<A> annotationType)
- {
- return getAnnotationStore().getAnnotation(annotationType);
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- public Set<Annotation> getAnnotations()
- {
- return getAnnotationStore().getAnnotations();
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- public Set<Annotation> getMetaAnnotations(Class<? extends Annotation>
metaAnnotationType)
- {
- return getAnnotationStore().getMetaAnnotations(metaAnnotationType);
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation>
metaAnnotationType)
- {
- return getAnnotationStore().getMetaAnnotationsAsArray(metaAnnotationType);
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- @Deprecated
- public Set<Annotation> getBindings()
- {
- return getAnnotationStore().getBindings();
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- @Deprecated
- public Annotation[] getBindingsAsArray()
- {
- return getAnnotationStore().getBindingsAsArray();
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- {
- return getAnnotationStore().isAnnotationPresent(annotationType);
- }
-
- public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends
Annotation> metaAnnotationType)
- {
- return getAnnotationStore().getDeclaredMetaAnnotations(metaAnnotationType);
- }
-
-}
Deleted:
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedWBParameter.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedWBParameter.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WrappedWBParameter.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -1,114 +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;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-public class WrappedWBParameter<T> extends ForwardingWBParameter<T>
-{
-
- public static <T> WrappedWBParameter<T> of(WBParameter<T> parameter,
Set<Annotation> extraAnnotations)
- {
- return new WrappedWBParameter<T>(parameter, extraAnnotations);
- }
-
- private final WBParameter<T> delegate;
- private AnnotationStore annotationStore;
-
- public WrappedWBParameter(WBParameter<T> parameter, Set<Annotation>
extraAnnotations)
- {
- this.delegate = parameter;
- this.annotationStore = AnnotationStore.wrap(parameter.getAnnotationStore(),
extraAnnotations, extraAnnotations);
- }
-
- @Override
- protected WBParameter<T> delegate()
- {
- return delegate;
- }
-
- @Override
- public AnnotationStore getAnnotationStore()
- {
- return annotationStore;
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- public <A extends Annotation> A getAnnotation(Class<A> annotationType)
- {
- return getAnnotationStore().getAnnotation(annotationType);
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- public Set<Annotation> getAnnotations()
- {
- return getAnnotationStore().getAnnotations();
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- public Set<Annotation> getMetaAnnotations(Class<? extends Annotation>
metaAnnotationType)
- {
- return getAnnotationStore().getMetaAnnotations(metaAnnotationType);
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- public Annotation[] getMetaAnnotationsAsArray(Class<? extends Annotation>
metaAnnotationType)
- {
- return getAnnotationStore().getMetaAnnotationsAsArray(metaAnnotationType);
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- @Deprecated
- public Set<Annotation> getBindings()
- {
- return getAnnotationStore().getBindings();
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- @Deprecated
- public Annotation[] getBindingsAsArray()
- {
- return getAnnotationStore().getBindingsAsArray();
- }
-
- /**
- * @see org.jboss.webbeans.introspector.WBAnnotated
- */
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- {
- return getAnnotationStore().isAnnotationPresent(annotationType);
- }
-
- public Set<Annotation> getDeclaredMetaAnnotations(Class<? extends
Annotation> metaAnnotationType)
- {
- return getAnnotationStore().getDeclaredMetaAnnotations(metaAnnotationType);
- }
-
-}
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-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBAnnotationImpl.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -70,14 +70,14 @@
*/
protected WBAnnotationImpl(Class<T> annotationType, ClassTransformer
classTransformer)
{
- super(AnnotationStore.of(annotationType), annotationType, annotationType,
classTransformer);
+ super(AnnotationStore.of(annotationType, classTransformer.getTypeStore()),
annotationType, annotationType, classTransformer);
this.clazz = annotationType;
members = new HashSet<WBMethod<?>>();
annotatedMembers = new SetHashMultiMap<Class<? extends Annotation>,
WBMethod<?>>();
this.namedMembers = new HashMap<String, WBMethod<?>>();
for (Method member : clazz.getDeclaredMethods())
{
- WBMethod<?> annotatedMethod = WBMethodImpl.of(member, this);
+ WBMethod<?> annotatedMethod = WBMethodImpl.of(member, this,
classTransformer);
members.add(annotatedMethod);
for (Annotation annotation : annotatedMethod.getAnnotations())
{
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-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -29,6 +29,8 @@
import java.util.Map;
import java.util.Set;
+import javax.enterprise.inject.spi.AnnotatedType;
+
import org.jboss.webbeans.introspector.AnnotationStore;
import org.jboss.webbeans.introspector.ConstructorSignature;
import org.jboss.webbeans.introspector.MethodSignature;
@@ -53,16 +55,16 @@
*/
public class WBClassImpl<T> extends AbstractWBType<T> implements
WBClass<T>
{
-
+
private static List<Class<?>> NO_ARGUMENTS = Collections.emptyList();
-
+
// The set of abstracted fields
private final Set<WBField<?>> fields;
// The map from annotation type to abstracted field with annotation
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;
-
+
// The set of abstracted fields
private final Set<WBField<?>> declaredFields;
private final Map<String, WBField<?>> declaredFieldsByName;
@@ -70,7 +72,7 @@
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;
-
+
// The set of abstracted methods
private final Set<WBMethod<?>> methods;
private final Map<MethodSignature, WBMethod<?>>
declaredMethodsBySignature;
@@ -79,14 +81,14 @@
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;
-
+
// The set of abstracted methods
private final Set<WBMethod<?>> declaredMethods;
// The map from annotation type to abstracted method with annotation
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;
-
+
// The set of abstracted constructors
private final Set<WBConstructor<T>> constructors;
private final Map<ConstructorSignature, WBConstructor<?>>
declaredConstructorsBySignature;
@@ -94,26 +96,32 @@
private final SetMultiMap<Class<? extends Annotation>,
WBConstructor<T>> annotatedConstructors;
// The map from class list to abstracted constructor
private final Map<List<Class<?>>, WBConstructor<T>>
constructorsByArgumentMap;
-
+
private final SetMultiMap<Class<? extends Annotation>,
WBConstructor<?>> constructorsByAnnotatedParameters;
-
+
// Cached string representation
private String toString;
-
+
private final boolean _nonStaticMemberClass;
private final boolean _abstract;
private final boolean _enum;
-
public static <T> WBClass<T> of(Class<T> clazz, ClassTransformer
classTransformer)
{
- return new WBClassImpl<T>(clazz, clazz, clazz.getAnnotations(),
clazz.getDeclaredAnnotations(), classTransformer);
+ AnnotationStore annotationStore = AnnotationStore.of(clazz.getAnnotations(),
clazz.getDeclaredAnnotations(), classTransformer.getTypeStore());
+ return new WBClassImpl<T>(clazz, clazz, annotationStore, classTransformer);
}
+
+ public static <T> WBClass<T> of(AnnotatedType<T> annotatedType,
ClassTransformer classTransformer)
+ {
+ AnnotationStore annotationStore =
AnnotationStore.of(annotatedType.getAnnotations(), annotatedType.getAnnotations(),
classTransformer.getTypeStore());
+ return new WBClassImpl<T>(annotatedType.getJavaClass(),
annotatedType.getBaseType(), annotationStore, classTransformer);
+ }
- private WBClassImpl(Class<T> rawType, Type type, Annotation[] annotations,
Annotation[] declaredAnnotations, ClassTransformer classTransformer)
+ private WBClassImpl(Class<T> rawType, Type type, AnnotationStore
annotationStore, ClassTransformer classTransformer)
{
- super(AnnotationStore.of(annotations, declaredAnnotations), rawType, type,
classTransformer);
-
+ super(annotationStore, rawType, type, classTransformer);
+
this.fields = new HashSet<WBField<?>>();
this.annotatedFields = new SetHashMultiMap<Class<? extends Annotation>,
WBField<?>>();
this.metaAnnotatedFields = new SetHashMultiMap<Class<? extends
Annotation>, WBField<?>>();
@@ -132,7 +140,7 @@
{
field.setAccessible(true);
}
- WBField<?> annotatedField = new WBFieldImpl<Object>(field,
this);
+ WBField<?> annotatedField = new WBFieldImpl<Object>(field, this,
classTransformer);
this.fields.add(annotatedField);
if (c == rawType)
{
@@ -155,10 +163,10 @@
}
}
}
-
+
}
}
-
+
this.constructors = new HashSet<WBConstructor<T>>();
this.constructorsByArgumentMap = new HashMap<List<Class<?>>,
WBConstructor<T>>();
this.annotatedConstructors = new SetHashMultiMap<Class<? extends
Annotation>, WBConstructor<T>>();
@@ -168,16 +176,16 @@
{
@SuppressWarnings("unchecked")
Constructor<T> c = (Constructor<T>) constructor;
- WBConstructor<T> annotatedConstructor = WBConstructorImpl.of(c, this);
+ WBConstructor<T> annotatedConstructor = WBConstructorImpl.of(c, this,
classTransformer);
if (!constructor.isAccessible())
{
constructor.setAccessible(true);
}
this.constructors.add(annotatedConstructor);
this.constructorsByArgumentMap.put(Arrays.asList(constructor.getParameterTypes()),
annotatedConstructor);
-
+
this.declaredConstructorsBySignature.put(annotatedConstructor.getSignature(),
annotatedConstructor);
-
+
for (Annotation annotation : annotatedConstructor.getAnnotations())
{
if (!annotatedConstructors.containsKey(annotation.annotationType()))
@@ -186,7 +194,7 @@
}
annotatedConstructors.get(annotation.annotationType()).add(annotatedConstructor);
}
-
+
for (Class<? extends Annotation> annotationType :
WBConstructor.MAPPED_PARAMETER_ANNOTATIONS)
{
if (annotatedConstructor.getAnnotatedParameters(annotationType).size() >
0)
@@ -195,7 +203,7 @@
}
}
}
-
+
this.methods = new HashSet<WBMethod<?>>();
this.annotatedMethods = new SetHashMultiMap<Class<? extends Annotation>,
WBMethod<?>>();
this.methodsByAnnotatedParameters = new SetHashMultiMap<Class<? extends
Annotation>, WBMethod<?>>();
@@ -212,8 +220,8 @@
{
method.setAccessible(true);
}
-
- WBMethod<?> annotatedMethod = WBMethodImpl.of(method, this);
+
+ WBMethod<?> annotatedMethod = WBMethodImpl.of(method, this,
classTransformer);
this.methods.add(annotatedMethod);
this.methodsBySignature.put(annotatedMethod.getSignature(),
annotatedMethod);
if (c == rawType)
@@ -243,7 +251,7 @@
}
}
}
-
+
/**
* Gets the implementing class
*
@@ -253,7 +261,7 @@
{
return getJavaClass();
}
-
+
/**
* Gets the delegate (class)
*
@@ -263,7 +271,7 @@
{
return getJavaClass();
}
-
+
/**
* Gets the abstracted fields of the class
*
@@ -275,22 +283,22 @@
{
return Collections.unmodifiableSet(fields);
}
-
+
public Set<WBField<?>> getDeclaredFields()
{
return Collections.unmodifiableSet(declaredFields);
}
-
+
public <F> WBField<F> getDeclaredField(String fieldName, WBClass<F>
expectedType)
{
return (WBField<F>) declaredFieldsByName.get(fieldName);
}
-
+
public Set<WBField<?>> getDeclaredAnnotatedFields(Class<? extends
Annotation> annotationType)
{
return Collections.unmodifiableSet(declaredAnnotatedFields.get(annotationType));
}
-
+
/**
* Gets the abstracted constructors of the class
*
@@ -302,12 +310,12 @@
{
return Collections.unmodifiableSet(constructors);
}
-
+
public WBConstructor<T> getDeclaredConstructor(ConstructorSignature signature)
{
return (WBConstructor<T>) declaredConstructorsBySignature.get(signature);
}
-
+
/**
* Gets abstracted fields with requested meta-annotation type present
*
@@ -316,8 +324,7 @@
* populated for the requested meta-annotation type and the result is
* returned
*
- * @param metaAnnotationType
- * The meta-annotation type to match
+ * @param metaAnnotationType The meta-annotation type to match
* @return The set of abstracted fields with meta-annotation present. Returns
* an empty set if no matches are found.
*/
@@ -325,14 +332,13 @@
{
return Collections.unmodifiableSet(metaAnnotatedFields.get(metaAnnotationType));
}
-
+
/**
* Gets the abstracted field annotated with a specific annotation type
*
* If the fields map is null, initialize it first
*
- * @param annotationType
- * The annotation type to match
+ * @param annotationType The annotation type to match
* @return A set of matching abstracted fields, null if none are found.
*
*/
@@ -340,29 +346,28 @@
{
return Collections.unmodifiableSet(annotatedFields.get(annotationType));
}
-
+
public boolean isNonStaticMemberClass()
{
return _nonStaticMemberClass;
}
-
+
public boolean isAbstract()
{
return _abstract;
}
-
+
public boolean isEnum()
{
return _enum;
}
-
+
/**
* Gets the abstracted methods that have a certain annotation type present
*
* If the annotated methods map is null, initialize it first
*
- * @param annotationType
- * The annotation type to match
+ * @param annotationType The annotation type to match
* @return A set of matching method abstractions. Returns an empty set if no
* matches are found.
*
@@ -372,17 +377,16 @@
{
return Collections.unmodifiableSet(annotatedMethods.get(annotationType));
}
-
+
public Set<WBMethod<?>> getDeclaredAnnotatedMethods(Class<? extends
Annotation> annotationType)
{
return Collections.unmodifiableSet(declaredAnnotatedMethods.get(annotationType));
}
-
+
/**
* Gets constructors with given annotation type
*
- * @param annotationType
- * The annotation type to match
+ * @param annotationType The annotation type to match
* @return A set of abstracted constructors with given annotation type. If
* the constructors set is empty, initialize it first. Returns an
* empty set if there are no matches.
@@ -393,27 +397,27 @@
{
return Collections.unmodifiableSet(annotatedConstructors.get(annotationType));
}
-
+
public WBConstructor<T> getNoArgsConstructor()
{
return constructorsByArgumentMap.get(NO_ARGUMENTS);
}
-
+
public Set<WBMethod<?>> getMethodsWithAnnotatedParameters(Class<?
extends Annotation> annotationType)
{
return
Collections.unmodifiableSet(methodsByAnnotatedParameters.get(annotationType));
}
-
+
public Set<WBConstructor<?>>
getConstructorsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
{
return
Collections.unmodifiableSet(constructorsByAnnotatedParameters.get(annotationType));
}
-
+
public Set<WBMethod<?>>
getDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation>
annotationType)
{
return
Collections.unmodifiableSet(declaredMethodsByAnnotatedParameters.get(annotationType));
}
-
+
public WBMethod<?> getMethod(Method methodDescriptor)
{
// TODO Should be cached
@@ -426,12 +430,12 @@
}
return null;
}
-
+
public Set<WBMethod<?>> getMethods()
{
return Collections.unmodifiableSet(methods);
}
-
+
public WBMethod<?> getDeclaredMethod(Method method)
{
// TODO Should be cached
@@ -444,19 +448,19 @@
}
return null;
}
-
+
@SuppressWarnings("unchecked")
public <M> WBMethod<M> getDeclaredMethod(MethodSignature signature,
WBClass<M> expectedReturnType)
{
return (WBMethod<M>) declaredMethodsBySignature.get(signature);
}
-
+
@SuppressWarnings("unchecked")
public <M> WBMethod<M> getMethod(MethodSignature signature)
{
return (WBMethod<M>) methodsBySignature.get(signature);
}
-
+
/**
* Gets a string representation of the class
*
@@ -472,17 +476,17 @@
toString = "Annotated class " + Names.classToString(getDelegate());
return toString;
}
-
+
@SuppressWarnings("unchecked")
public <U> WBClass<? extends U> asSubclass(WBClass<U> clazz)
{
return (WBClass<? extends U>) this;
}
-
+
@SuppressWarnings("unchecked")
public T cast(Object object)
{
return (T) object;
}
-
+
}
\ 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-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBConstructorImpl.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -30,6 +30,7 @@
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;
import org.jboss.webbeans.util.collections.multi.ListHashMultiMap;
import org.jboss.webbeans.util.collections.multi.ListMultiMap;
@@ -62,9 +63,9 @@
// Cached string representation
private String toString;
- public static <T> WBConstructor<T> of(Constructor<T> constructor,
WBType<T> declaringClass)
+ public static <T> WBConstructor<T> of(Constructor<T> constructor,
WBType<T> declaringClass, ClassTransformer classTransformer)
{
- return new WBConstructorImpl<T>(constructor, declaringClass);
+ return new WBConstructorImpl<T>(constructor, declaringClass,
classTransformer);
}
/**
@@ -75,9 +76,9 @@
* @param constructor The constructor method
* @param declaringClass The declaring class
*/
- protected WBConstructorImpl(Constructor<T> constructor, WBType<T>
declaringClass)
+ protected WBConstructorImpl(Constructor<T> constructor, WBType<T>
declaringClass, ClassTransformer classTransformer)
{
- super(AnnotationStore.of(constructor), constructor,
constructor.getDeclaringClass(), constructor.getDeclaringClass());
+ super(AnnotationStore.of(constructor, classTransformer.getTypeStore()),
constructor, constructor.getDeclaringClass(), constructor.getDeclaringClass());
this.constructor = constructor;
this.declaringClass = declaringClass;
@@ -90,7 +91,7 @@
{
Class<?> clazz = constructor.getParameterTypes()[i];
Type type = constructor.getGenericParameterTypes()[i];
- WBParameter<?> parameter =
WBParameterImpl.of(constructor.getParameterAnnotations()[i], clazz, type, this);
+ WBParameter<?> parameter =
WBParameterImpl.of(constructor.getParameterAnnotations()[i], clazz, type, this,
classTransformer);
parameters.add(parameter);
for (Annotation annotation : parameter.getAnnotations())
@@ -110,7 +111,7 @@
{
type = clazz;
}
- WBParameter<?> parameter = WBParameterImpl.of(new Annotation[0], clazz,
type, this);
+ WBParameter<?> parameter = WBParameterImpl.of(new Annotation[0], clazz,
type, this, classTransformer);
parameters.add(parameter);
for (Annotation annotation : parameter.getAnnotations())
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-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBFieldImpl.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -21,6 +21,7 @@
import org.jboss.webbeans.introspector.AnnotationStore;
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;
@@ -53,9 +54,9 @@
* @param field The actual field
* @param declaringClass The abstraction of the declaring class
*/
- protected WBFieldImpl(Field field, WBType<?> declaringClass)
+ protected WBFieldImpl(Field field, WBType<?> declaringClass, ClassTransformer
classTransformer)
{
- super(AnnotationStore.of(field), field, (Class<T>) field.getType(),
field.getGenericType());
+ super(AnnotationStore.of(field, classTransformer.getTypeStore()), field,
(Class<T>) field.getType(), field.getGenericType());
this.field = field;
field.setAccessible(true);
this.declaringClass = declaringClass;
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-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBMethodImpl.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -30,6 +30,7 @@
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;
import org.jboss.webbeans.util.collections.multi.ListHashMultiMap;
@@ -67,9 +68,9 @@
private final MethodSignature signature;
- public static <T> WBMethodImpl<T> of(Method method, WBType<?>
declaringClass)
+ public static <T> WBMethodImpl<T> of(Method method, WBType<?>
declaringClass, ClassTransformer classTransformer)
{
- return new WBMethodImpl<T>(method, declaringClass);
+ return new WBMethodImpl<T>(method, declaringClass, classTransformer);
}
/**
@@ -82,9 +83,9 @@
* @param declaringClass The declaring class abstraction
*/
@SuppressWarnings("unchecked")
- protected WBMethodImpl(Method method, WBType<?> declaringClass)
+ protected WBMethodImpl(Method method, WBType<?> declaringClass, ClassTransformer
classTransformer)
{
- super(AnnotationStore.of(method), method, (Class<T>) method.getReturnType(),
method.getGenericReturnType());
+ super(AnnotationStore.of(method, classTransformer.getTypeStore()), method,
(Class<T>) method.getReturnType(), method.getGenericReturnType());
this.method = method;
this.method.setAccessible(true);
this.declaringClass = declaringClass;
@@ -97,7 +98,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);
+ WBParameter<?> parameter =
WBParameterImpl.of(method.getParameterAnnotations()[i], (Class<Object>) clazz, type,
this, classTransformer);
this.parameters.add(parameter);
for (Annotation annotation : parameter.getAnnotations())
{
@@ -111,7 +112,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);
+ WBParameter<?> parameter = WBParameterImpl.of(new Annotation[0],
(Class<Object>) clazz, type, this, classTransformer);
this.parameters.add(parameter);
}
}
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-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBParameterImpl.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -23,6 +23,7 @@
import org.jboss.webbeans.introspector.AnnotationStore;
import org.jboss.webbeans.introspector.WBMember;
import org.jboss.webbeans.introspector.WBParameter;
+import org.jboss.webbeans.resources.ClassTransformer;
/**
* Represents a parameter
@@ -47,9 +48,9 @@
// Cached string representation
private String toString;
- public static <T> WBParameter<T> of(Annotation[] annotations,
Class<T> rawType, Type type, WBMember<?, ?> declaringMember)
+ public static <T> WBParameter<T> of(Annotation[] annotations,
Class<T> rawType, Type type, WBMember<?, ?> declaringMember, ClassTransformer
classTransformer)
{
- return new WBParameterImpl<T>(annotations, rawType, type, declaringMember);
+ return new WBParameterImpl<T>(annotations, rawType, type, declaringMember,
classTransformer);
}
/**
@@ -58,9 +59,9 @@
* @param annotations The annotations array
* @param type The type of the parameter
*/
- protected WBParameterImpl(Annotation[] annotations, Class<T> rawType, Type type,
WBMember<?, ?> declaringMember)
+ protected WBParameterImpl(Annotation[] annotations, Class<T> rawType, Type type,
WBMember<?, ?> declaringMember, ClassTransformer classTransformer)
{
- super(AnnotationStore.of(annotations, annotations), rawType, type);
+ super(AnnotationStore.of(annotations, annotations,
classTransformer.getTypeStore()), rawType, type);
this.declaringMember = declaringMember;
}
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/TypeStore.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/TypeStore.java
(rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/TypeStore.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -0,0 +1,56 @@
+/*
+ * 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.metadata;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+
+import org.jboss.webbeans.bootstrap.api.Service;
+import org.jboss.webbeans.util.collections.multi.ConcurrentSetHashMultiMap;
+import org.jboss.webbeans.util.collections.multi.ConcurrentSetMultiMap;
+
+/**
+ * @author pmuir
+ *
+ */
+public class TypeStore implements Service
+{
+
+ private final ConcurrentSetMultiMap<Class<? extends Annotation>,
Annotation> extraAnnotations;
+
+ public TypeStore()
+ {
+ this.extraAnnotations = new ConcurrentSetHashMultiMap<Class<? extends
Annotation>, Annotation>();
+ }
+
+ public Set<Annotation> get(Class<? extends Annotation> annotationType)
+ {
+ return extraAnnotations.get(annotationType);
+ }
+
+ public void add(Class<? extends Annotation> annotationType, Annotation
annotation)
+ {
+ this.extraAnnotations.put(annotationType, annotation);
+ }
+
+ public void addAll(Class<? extends Annotation> annotationType,
Set<Annotation> annotations)
+ {
+ this.extraAnnotations.putIfAbsent(annotationType, new
CopyOnWriteArraySet<Annotation>());
+ this.extraAnnotations.get(annotationType).addAll(annotations);
+ }
+}
Property changes on:
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/TypeStore.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MergedStereotypes.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MergedStereotypes.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MergedStereotypes.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -69,7 +69,7 @@
for (Annotation stereotypeAnnotation : stereotypeAnnotations)
{
// Retrieve and merge all metadata from stereotypes
- StereotypeModel<?> stereotype =
manager.getServices().get(MetaDataCache.class).getStereotype(stereotypeAnnotation.annotationType());
+ StereotypeModel<?> stereotype =
manager.getServices().get(MetaAnnotationStore.class).getStereotype(stereotypeAnnotation.annotationType());
if (stereotype == null)
{
throw new IllegalStateException("Stereotype " +
stereotypeAnnotation + " not registered with container");
Copied:
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MetaAnnotationStore.java
(from rev 2903,
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MetaDataCache.java)
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MetaAnnotationStore.java
(rev 0)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MetaAnnotationStore.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -0,0 +1,130 @@
+/*
+ * 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.metadata.cache;
+
+import java.lang.annotation.Annotation;
+import java.util.concurrent.Callable;
+
+import org.jboss.webbeans.bootstrap.api.Service;
+import org.jboss.webbeans.resources.ClassTransformer;
+import org.jboss.webbeans.util.collections.ConcurrentCache;
+
+/**
+ * Metadata singleton for holding EJB metadata, scope models etc.
+ *
+ * @author Pete Muir
+ *
+ */
+public class MetaAnnotationStore implements Service
+{
+
+ // The stereotype models
+ private ConcurrentCache<Class<? extends Annotation>,
StereotypeModel<?>> stereotypes = new ConcurrentCache<Class<? extends
Annotation>, StereotypeModel<?>>();
+ // The scope models
+ private ConcurrentCache<Class<? extends Annotation>, ScopeModel<?>>
scopes = new ConcurrentCache<Class<? extends Annotation>,
ScopeModel<?>>();
+ // The binding type models
+ private ConcurrentCache<Class<? extends Annotation>,
BindingTypeModel<?>> bindingTypes = new ConcurrentCache<Class<? extends
Annotation>, BindingTypeModel<?>>();
+
+ private final ClassTransformer classTransformer;
+
+ public MetaAnnotationStore(ClassTransformer classTransformer)
+ {
+ this.classTransformer = classTransformer;
+ }
+
+ /**
+ * Gets a stereotype model
+ *
+ * Adds the model if it is not present.
+ *
+ * @param <T> The type
+ * @param stereotype The stereotype
+ * @return The stereotype model
+ */
+ public <T extends Annotation> StereotypeModel<T> getStereotype(final
Class<T> stereotype)
+ {
+ return stereotypes.putIfAbsent(stereotype, new
Callable<StereotypeModel<T>>()
+ {
+
+ public StereotypeModel<T> call() throws Exception
+ {
+ return new StereotypeModel<T>(stereotype, classTransformer);
+ }
+ });
+ }
+
+ /**
+ * Gets a scope model
+ *
+ * Adds the model if it is not present.
+ *
+ * @param <T> The type
+ * @param scopeType The scope type
+ * @return The scope type model
+ */
+ public <T extends Annotation> ScopeModel<T> getScopeModel(final
Class<T> scopeType)
+ {
+ return scopes.putIfAbsent(scopeType, new Callable<ScopeModel<T>>()
+ {
+
+ public ScopeModel<T> call() throws Exception
+ {
+ return new ScopeModel<T>(scopeType, classTransformer);
+ }
+
+ });
+ }
+
+ /**
+ * Gets a binding type model.
+ *
+ * Adds the model if it is not present.
+ *
+ * @param <T> The type
+ * @param bindingType The binding type
+ * @return The binding type model
+ */
+ public <T extends Annotation> BindingTypeModel<T>
getBindingTypeModel(final Class<T> bindingType)
+ {
+ return bindingTypes.putIfAbsent(bindingType, new
Callable<BindingTypeModel<T>>()
+ {
+
+ public BindingTypeModel<T> call() throws Exception
+ {
+ return new BindingTypeModel<T>(bindingType, classTransformer);
+ }
+
+ });
+ }
+
+ /**
+ * Gets a string representation
+ *
+ * @return A string representation
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("Metadata cache\n");
+ buffer.append("Registered binding type models: " + bindingTypes.size() +
"\n");
+ buffer.append("Registered scope type models: " + scopes.size() +
"\n");
+ buffer.append("Registered stereotype models: " + stereotypes.size() +
"\n");
+ return buffer.toString();
+ }
+
+}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MetaDataCache.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MetaDataCache.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MetaDataCache.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -1,130 +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.metadata.cache;
-
-import java.lang.annotation.Annotation;
-import java.util.concurrent.Callable;
-
-import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.util.collections.ConcurrentCache;
-
-/**
- * Metadata singleton for holding EJB metadata, scope models etc.
- *
- * @author Pete Muir
- *
- */
-public class MetaDataCache implements Service
-{
-
- // The stereotype models
- private ConcurrentCache<Class<? extends Annotation>,
StereotypeModel<?>> stereotypes = new ConcurrentCache<Class<? extends
Annotation>, StereotypeModel<?>>();
- // The scope models
- private ConcurrentCache<Class<? extends Annotation>, ScopeModel<?>>
scopes = new ConcurrentCache<Class<? extends Annotation>,
ScopeModel<?>>();
- // The binding type models
- private ConcurrentCache<Class<? extends Annotation>,
BindingTypeModel<?>> bindingTypes = new ConcurrentCache<Class<? extends
Annotation>, BindingTypeModel<?>>();
-
- private final ClassTransformer classTransformer;
-
- public MetaDataCache(ClassTransformer classTransformer)
- {
- this.classTransformer = classTransformer;
- }
-
- /**
- * Gets a stereotype model
- *
- * Adds the model if it is not present.
- *
- * @param <T> The type
- * @param stereotype The stereotype
- * @return The stereotype model
- */
- public <T extends Annotation> StereotypeModel<T> getStereotype(final
Class<T> stereotype)
- {
- return stereotypes.putIfAbsent(stereotype, new
Callable<StereotypeModel<T>>()
- {
-
- public StereotypeModel<T> call() throws Exception
- {
- return new StereotypeModel<T>(stereotype, classTransformer);
- }
- });
- }
-
- /**
- * Gets a scope model
- *
- * Adds the model if it is not present.
- *
- * @param <T> The type
- * @param scopeType The scope type
- * @return The scope type model
- */
- public <T extends Annotation> ScopeModel<T> getScopeModel(final
Class<T> scopeType)
- {
- return scopes.putIfAbsent(scopeType, new Callable<ScopeModel<T>>()
- {
-
- public ScopeModel<T> call() throws Exception
- {
- return new ScopeModel<T>(scopeType, classTransformer);
- }
-
- });
- }
-
- /**
- * Gets a binding type model.
- *
- * Adds the model if it is not present.
- *
- * @param <T> The type
- * @param bindingType The binding type
- * @return The binding type model
- */
- public <T extends Annotation> BindingTypeModel<T>
getBindingTypeModel(final Class<T> bindingType)
- {
- return bindingTypes.putIfAbsent(bindingType, new
Callable<BindingTypeModel<T>>()
- {
-
- public BindingTypeModel<T> call() throws Exception
- {
- return new BindingTypeModel<T>(bindingType, classTransformer);
- }
-
- });
- }
-
- /**
- * Gets a string representation
- *
- * @return A string representation
- */
- @Override
- public String toString()
- {
- StringBuilder buffer = new StringBuilder();
- buffer.append("Metadata cache\n");
- buffer.append("Registered binding type models: " + bindingTypes.size() +
"\n");
- buffer.append("Registered scope type models: " + scopes.size() +
"\n");
- buffer.append("Registered stereotype models: " + stereotypes.size() +
"\n");
- return buffer.toString();
- }
-
-}
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -17,8 +17,6 @@
package org.jboss.webbeans.metadata.cache;
import java.lang.annotation.Annotation;
-import java.util.Arrays;
-import java.util.HashSet;
import java.util.Set;
import javax.enterprise.context.ScopeType;
@@ -64,8 +62,6 @@
initDefaultDeploymentType();
initDefaultScopeType();
initBeanNameDefaulted();
- initSupportedScopes();
- initRequiredTypes();
initInterceptorBindings();
checkBindings();
}
@@ -91,32 +87,6 @@
}
/**
- * Initializes the supported scopes
- */
- private void initSupportedScopes()
- {
- this.supportedScopes = new HashSet<Class<? extends Annotation>>();
- Class<? extends Annotation>[] supportedScopes =
getAnnotatedAnnotation().getAnnotation(Stereotype.class).supportedScopes();
- if (supportedScopes.length > 0)
- {
- this.supportedScopes.addAll(Arrays.asList(supportedScopes));
- }
- }
-
- /**
- * Initializes the required types
- */
- private void initRequiredTypes()
- {
- this.requiredTypes = new HashSet<Class<?>>();
- Class<?>[] requiredTypes =
getAnnotatedAnnotation().getAnnotation(Stereotype.class).requiredTypes();
- if (requiredTypes.length > 0)
- {
- this.requiredTypes.addAll(Arrays.asList(requiredTypes));
- }
- }
-
- /**
* Initializes the bean name defaulted
*/
private void initBeanNameDefaulted()
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/resources/ClassTransformer.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/resources/ClassTransformer.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/resources/ClassTransformer.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -19,27 +19,34 @@
import java.lang.annotation.Annotation;
import java.util.concurrent.Callable;
+import javax.enterprise.inject.spi.AnnotatedType;
+
import org.jboss.webbeans.bootstrap.api.Service;
import org.jboss.webbeans.introspector.WBAnnotation;
import org.jboss.webbeans.introspector.WBClass;
import org.jboss.webbeans.introspector.jlr.WBAnnotationImpl;
import org.jboss.webbeans.introspector.jlr.WBClassImpl;
+import org.jboss.webbeans.metadata.TypeStore;
import org.jboss.webbeans.util.collections.ConcurrentCache;
public class ClassTransformer implements Service
{
private final ConcurrentCache<Class<?>, WBClass<?>> classes;
+ private final ConcurrentCache<AnnotatedType<?>, WBClass<?>>
annotatedTypes;
private final ConcurrentCache<Class<?>, WBAnnotation<?>>
annotations;
private final ClassTransformer transformer = this;
+ private final TypeStore typeStore;
/**
*
*/
- public ClassTransformer()
+ public ClassTransformer(TypeStore typeStore)
{
classes = new ConcurrentCache<Class<?>, WBClass<?>>();
+ this.annotatedTypes = new ConcurrentCache<AnnotatedType<?>,
WBClass<?>>();
annotations = new ConcurrentCache<Class<?>, WBAnnotation<?>>();
+ this.typeStore = typeStore;
}
public <T> WBClass<T> loadClass(final Class<T> clazz)
@@ -54,7 +61,20 @@
});
}
+
+ public <T> WBClass<T> loadClass(final AnnotatedType<T> clazz)
+ {
+ return annotatedTypes.putIfAbsent(clazz, new Callable<WBClass<T>>()
+ {
+ public WBClass<T> call() throws Exception
+ {
+ return WBClassImpl.of(clazz, transformer);
+ }
+
+ });
+ }
+
public <T extends Annotation> WBAnnotation<T> loadAnnotation(final
Class<T> clazz)
{
return annotations.putIfAbsent(clazz, new Callable<WBAnnotation<T>>()
@@ -66,5 +86,10 @@
});
}
+
+ public TypeStore getTypeStore()
+ {
+ return typeStore;
+ }
}
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-06-28 15:05:58 UTC
(rev 2913)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java 2009-06-28 15:17:17 UTC
(rev 2914)
@@ -33,7 +33,7 @@
import org.jboss.webbeans.introspector.WBClass;
import org.jboss.webbeans.introspector.WBField;
import org.jboss.webbeans.metadata.cache.BindingTypeModel;
-import org.jboss.webbeans.metadata.cache.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaAnnotationStore;
/**
* Helper class for bean inspection
@@ -58,7 +58,7 @@
}
else
{
- return
manager.getServices().get(MetaDataCache.class).getScopeModel(bean.getScopeType()).isPassivating();
+ return
manager.getServices().get(MetaAnnotationStore.class).getScopeModel(bean.getScopeType()).isPassivating();
}
}
@@ -122,7 +122,7 @@
{
for (Annotation binding : bindings1)
{
- BindingTypeModel<?> bindingType =
manager.getServices().get(MetaDataCache.class).getBindingTypeModel(binding.annotationType());
+ BindingTypeModel<?> bindingType =
manager.getServices().get(MetaAnnotationStore.class).getBindingTypeModel(binding.annotationType());
if (bindingType.getNonBindingTypes().size() > 0)
{
boolean matchFound = false;
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/context/PassivatingContextTest.java
===================================================================
---
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/context/PassivatingContextTest.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/context/PassivatingContextTest.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -6,7 +6,7 @@
import javax.enterprise.context.SessionScoped;
import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.webbeans.metadata.cache.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaAnnotationStore;
import org.testng.annotations.Test;
@Artifact
@@ -20,7 +20,7 @@
@Test(groups = { "contexts", "passivation" })
public void testIsSessionScopePassivating()
{
- assert
getCurrentManager().getServices().get(MetaDataCache.class).getScopeModel(SessionScoped.class).isPassivating();
+ assert
getCurrentManager().getServices().get(MetaAnnotationStore.class).getScopeModel(SessionScoped.class).isPassivating();
}
/**
@@ -30,7 +30,7 @@
@Test(groups = { "contexts", "passivation" })
public void testIsConversationScopePassivating()
{
- assert
getCurrentManager().getServices().get(MetaDataCache.class).getScopeModel(ConversationScoped.class).isPassivating();
+ assert
getCurrentManager().getServices().get(MetaAnnotationStore.class).getScopeModel(ConversationScoped.class).isPassivating();
}
/**
@@ -40,7 +40,7 @@
@Test(groups = { "contexts", "passivation" })
public void testIsApplicationScopeNonPassivating()
{
- assert
!getCurrentManager().getServices().get(MetaDataCache.class).getScopeModel(ApplicationScoped.class).isPassivating();
+ assert
!getCurrentManager().getServices().get(MetaAnnotationStore.class).getScopeModel(ApplicationScoped.class).isPassivating();
}
/**
@@ -50,7 +50,7 @@
@Test(groups = { "contexts", "passivation" })
public void testIsRequestScopeNonPassivating()
{
- assert
!getCurrentManager().getServices().get(MetaDataCache.class).getScopeModel(RequestScoped.class).isPassivating();
+ assert
!getCurrentManager().getServices().get(MetaAnnotationStore.class).getScopeModel(RequestScoped.class).isPassivating();
}
}
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/AnimalOrderStereotype.java
===================================================================
---
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/AnimalOrderStereotype.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/AnimalOrderStereotype.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -10,7 +10,7 @@
-(a)Stereotype(requiredTypes={Animal.class, Order.class})
+@Stereotype
@Target( { TYPE })
@Retention(RUNTIME)
@interface AnimalOrderStereotype
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/AnimalStereotype.java
===================================================================
---
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/AnimalStereotype.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/AnimalStereotype.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -11,7 +11,7 @@
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.stereotype.Stereotype;
-(a)Stereotype(requiredTypes=Animal.class)
+@Stereotype
@Target( { TYPE, METHOD, FIELD })
@Retention(RUNTIME)
@RequestScoped
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/RequestScopedAnimalStereotype.java
===================================================================
---
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/RequestScopedAnimalStereotype.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/RequestScopedAnimalStereotype.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -6,10 +6,9 @@
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.stereotype.Stereotype;
-(a)Stereotype(requiredTypes=Animal.class, supportedScopes=RequestScoped.class)
+@Stereotype
@Target( { TYPE })
@Retention(RUNTIME)
public @interface RequestScopedAnimalStereotype
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/StereotypesTest.java
===================================================================
---
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/StereotypesTest.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/StereotypesTest.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -5,6 +5,7 @@
import javax.enterprise.context.RequestScoped;
import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.webbeans.metadata.TypeStore;
import org.jboss.webbeans.metadata.cache.StereotypeModel;
import org.jboss.webbeans.resources.ClassTransformer;
import org.jboss.webbeans.test.AbstractWebBeansTest;
@@ -14,7 +15,7 @@
public class StereotypesTest extends AbstractWebBeansTest
{
- private final ClassTransformer transformer = new ClassTransformer();
+ private final ClassTransformer transformer = new ClassTransformer(new TypeStore());
@Test
public void testAnimalStereotype()
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/ClassAnnotatedItemTest.java
===================================================================
---
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/ClassAnnotatedItemTest.java 2009-06-28
15:05:58 UTC (rev 2913)
+++
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/annotatedItem/ClassAnnotatedItemTest.java 2009-06-28
15:17:17 UTC (rev 2914)
@@ -11,6 +11,7 @@
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.webbeans.introspector.WBClass;
import org.jboss.webbeans.introspector.jlr.WBClassImpl;
+import org.jboss.webbeans.metadata.TypeStore;
import org.jboss.webbeans.resources.ClassTransformer;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;
@@ -19,7 +20,7 @@
public class ClassAnnotatedItemTest extends AbstractWebBeansTest
{
- private final ClassTransformer transformer = new ClassTransformer();
+ private final ClassTransformer transformer = new ClassTransformer(new TypeStore());
@Test
public void testDeclaredAnnotations()