[webbeans-commits] Webbeans SVN: r2903 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/bean and 10 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Fri Jun 26 13:12:23 EDT 2009
Author: pete.muir at jboss.org
Date: 2009-06-26 13:12:22 -0400 (Fri, 26 Jun 2009)
New Revision: 2903
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/AnnotationModel.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/BindingTypeModel.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/MetaDataCache.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/ScopeModel.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java
Removed:
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/AnnotationModel.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/BindingTypeModel.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MergedStereotypes.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MetaDataCache.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/ScopeModel.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/StereotypeModel.java
Modified:
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/BeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployer.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/NonContextualInjector.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBType.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/StereotypesTest.java
Log:
rename package
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-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -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.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.Proxies;
import org.jboss.webbeans.util.Reflections;
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-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/FacadeImpl.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -24,7 +24,7 @@
import java.util.HashSet;
import java.util.Set;
-import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
/**
* Common implementation for binding-type-based helpers
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-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -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.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.ListComparator;
import org.jboss.webbeans.util.Names;
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-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -46,8 +46,8 @@
import org.jboss.webbeans.literal.CurrentLiteral;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.metadata.MergedStereotypes;
-import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MergedStereotypes;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
import org.jboss.webbeans.util.Reflections;
/**
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-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -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.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.Names;
import org.jboss.webbeans.util.Reflections;
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-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -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.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
import org.jboss.webbeans.persistence.PersistenceApiAbstraction;
import org.jboss.webbeans.persistence.spi.JpaServices;
import org.jboss.webbeans.resources.spi.ResourceServices;
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-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -61,7 +61,7 @@
ClassTransformer classTransformer = getManager().getServices().get(ClassTransformer.class);
if (!clazz.isAnnotation() && !clazz.isEnum())
{
- classes.add(classTransformer.classForName(clazz));
+ classes.add(classTransformer.loadClass(clazz));
}
return this;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployer.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployer.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -48,7 +48,7 @@
for (Extension extension : extensions)
{
@SuppressWarnings("unchecked")
- WBClass<Extension> clazz = (WBClass<Extension>) classTransformer.classForName(extension.getClass());
+ WBClass<Extension> clazz = (WBClass<Extension>) classTransformer.loadClass(extension.getClass());
ExtensionBean bean = ExtensionBean.of(getManager(), clazz, extension);
addBean(bean);
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-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -51,7 +51,7 @@
import org.jboss.webbeans.log.Log;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.messaging.spi.JmsServices;
-import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
import org.jboss.webbeans.persistence.PersistenceApiAbstraction;
import org.jboss.webbeans.persistence.spi.JpaServices;
import org.jboss.webbeans.resources.ClassTransformer;
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-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventObserver.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -25,7 +25,7 @@
import javax.enterprise.inject.Current;
import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
import org.jboss.webbeans.util.Reflections;
import org.jboss.webbeans.util.Strings;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -117,7 +117,7 @@
public Set<FieldInjectionPoint<?>> call() throws Exception
{
- return Beans.getFieldInjectionPoints(manager.getServices().get(ClassTransformer.class).classForName(instance.getClass()), nonContextualBean);
+ return Beans.getFieldInjectionPoints(manager.getServices().get(ClassTransformer.class).loadClass(instance.getClass()), nonContextualBean);
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBType.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBType.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractWBType.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -61,7 +61,7 @@
this._simpleName = rawType.getSimpleName();
if (rawType.getSuperclass() != null)
{
- this.superclass = classTransformer.classForName(rawType.getSuperclass());
+ this.superclass = classTransformer.loadClass(rawType.getSuperclass());
}
else
{
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/AnnotationModel.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/AnnotationModel.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/AnnotationModel.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -1,124 +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;
-
-import java.lang.annotation.Annotation;
-
-import org.jboss.webbeans.DefinitionException;
-import org.jboss.webbeans.introspector.WBAnnotation;
-import org.jboss.webbeans.resources.ClassTransformer;
-
-/**
- * Abstract representation of an annotation model
- *
- * @author Pete Muir
- */
-public abstract class AnnotationModel<T extends Annotation>
-{
- // The underlying annotation
- private WBAnnotation<T> annotatedAnnotation;
- // Is the data valid?
- private boolean valid;
-
- /**
- * Constructor
- *
- * @param type The annotation type
- */
- public AnnotationModel(Class<T> type, ClassTransformer transformer)
- {
- this.annotatedAnnotation = transformer.annotationTypeForName(type);
- init();
- }
-
- /**
- * Initializes the type and validates it
- */
- protected void init()
- {
- initType();
- initValid();
- }
-
- /**
- * Initializes the type
- */
- protected void initType()
- {
- if (!Annotation.class.isAssignableFrom(getRawType()))
- {
- throw new DefinitionException(getMetaAnnotation().toString() + " can only be applied to an annotation, it was applied to " + getRawType());
- }
- }
-
- /**
- * Validates the data for correct annotation
- */
- protected void initValid()
- {
- this.valid = annotatedAnnotation.isAnnotationPresent(getMetaAnnotation());
- }
-
- /**
- * Gets the type of the annotation
- *
- * @return The type
- */
- public Class<T> getRawType()
- {
- return annotatedAnnotation.getJavaClass();
- }
-
- /**
- * Gets the meta-annotation that should be present
- *
- * @return
- */
- protected abstract Class<? extends Annotation> getMetaAnnotation();
-
- /**
- * Indicates if the annotation is valid
- *
- * @return True if valid, false otherwise
- */
- public boolean isValid()
- {
- return valid;
- }
-
- /**
- * Gets the annotated annotation
- *
- * @return The annotation
- */
- protected WBAnnotation<T> getAnnotatedAnnotation()
- {
- return annotatedAnnotation;
- }
-
- /**
- * Gets a string representation of the annotation model
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- return (isValid() ? "Valid" : "Invalid") + " annotation model for " + getRawType();
- }
-
-}
\ No newline at end of file
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/BindingTypeModel.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/BindingTypeModel.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/BindingTypeModel.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -1,174 +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;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Set;
-
-import javax.enterprise.inject.BindingType;
-import javax.enterprise.inject.NonBinding;
-
-import org.jboss.webbeans.DefinitionException;
-import org.jboss.webbeans.introspector.WBMethod;
-import org.jboss.webbeans.resources.ClassTransformer;
-import org.jboss.webbeans.util.Reflections;
-
-/**
- *
- * Model of a binding type
- *
- * @author Pete Muir
- *
- */
-public class BindingTypeModel<T extends Annotation> extends AnnotationModel<T>
-{
- // The non-binding types
- private Set<WBMethod<?>> nonBindingTypes;
-
- /**
- * Constructor
- *
- * @param type The type
- */
- public BindingTypeModel(Class<T> type, ClassTransformer transformer)
- {
- super(type, transformer);
- }
-
- /**
- * Initializes the non-binding types and validates the members
- */
- @Override
- protected void init()
- {
- super.init();
- initNonBindingTypes();
- checkArrayAndAnnotationValuedMembers();
- }
-
- /**
- * Validates the members
- */
- private void checkArrayAndAnnotationValuedMembers()
- {
- for (WBMethod<?> annotatedMethod : getAnnotatedAnnotation().getMembers())
- {
- if ((Reflections.isArrayType(annotatedMethod.getJavaClass()) || Annotation.class.isAssignableFrom(annotatedMethod.getJavaClass())) && !nonBindingTypes.contains(annotatedMethod))
- {
- throw new DefinitionException("Member of array type or annotation type must be annotated @NonBinding " + annotatedMethod);
- }
- }
-
- }
-
- /**
- * Gets the meta-annotation type
- *
- * @return The BindingType class
- */
- @Override
- protected Class<? extends Annotation> getMetaAnnotation()
- {
- return BindingType.class;
- }
-
- /**
- * Indicates if there are non-binding types present
- *
- * @return True if present, false otherwise
- */
- public boolean hasNonBindingTypes()
- {
- return nonBindingTypes.size() > 0;
- }
-
- /**
- * Gets the non-binding types
- *
- * @return A set of non-binding types, or an empty set if there are none
- * present
- */
- public Set<WBMethod<?>> getNonBindingTypes()
- {
- return nonBindingTypes;
- }
-
- /**
- * Initializes the non-binding types
- */
- protected void initNonBindingTypes()
- {
- nonBindingTypes = getAnnotatedAnnotation().getAnnotatedMembers(NonBinding.class);
- }
-
- /**
- * Comparator for checking equality
- *
- * @param instance The instance to check against
- * @param other The other binding type
- * @return True if equal, false otherwise
- */
- public boolean isEqual(Annotation instance, Annotation other)
- {
- if (instance.annotationType().equals(getRawType()) && other.annotationType().equals(getRawType()))
- {
- for (WBMethod<?> annotatedMethod : getAnnotatedAnnotation().getMembers())
- {
- if (!nonBindingTypes.contains(annotatedMethod))
- {
- try
- {
- Object thisValue = annotatedMethod.invoke(instance);
- Object thatValue = annotatedMethod.invoke(other);
- if (!thisValue.equals(thatValue))
- {
- return false;
- }
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e);
- }
- catch (InvocationTargetException e)
- {
- throw new RuntimeException(e);
- }
-
- }
- }
- return true;
- }
- return false;
- }
-
- /**
- * Gets a string representation of the binding type model
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- return (isValid() ? "Valid" : "Invalid") + " binding type model for " + getRawType() + " with non-binding types " + getNonBindingTypes();
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MergedStereotypes.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MergedStereotypes.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MergedStereotypes.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -1,167 +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;
-
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.webbeans.BeanManagerImpl;
-
-/**
- * Meta model for the merged stereotype for a bean
- *
- * @author Pete Muir
- */
-public class MergedStereotypes<T, E>
-{
- // The possible deployment types
- private final Map<Class<? extends Annotation>, Annotation> possibleDeploymentTypes;
- // The possible scope types
- private final Set<Annotation> possibleScopeTypes;
- // Is the bean name defaulted?
- private boolean beanNameDefaulted;
- // The required types
- private final Set<Class<?>> requiredTypes;
- // The supported scopes
- private final Set<Class<? extends Annotation>> supportedScopes;
-
- private final BeanManagerImpl manager;
-
- /**
- * Constructor
- *
- * @param stereotypeAnnotations The stereotypes to merge
- */
- public MergedStereotypes(Set<Annotation> stereotypeAnnotations, BeanManagerImpl manager)
- {
- this.possibleDeploymentTypes = new HashMap<Class<? extends Annotation>, Annotation>();
- this.possibleScopeTypes = new HashSet<Annotation>();
- this.requiredTypes = new HashSet<Class<?>>();
- this.supportedScopes = new HashSet<Class<? extends Annotation>>();
- this.manager = manager;
- merge(stereotypeAnnotations);
- }
-
- /**
- * Perform the merge
- *
- * @param stereotypeAnnotations The stereotype annotations
- */
- protected void merge(Set<Annotation> stereotypeAnnotations)
- {
- for (Annotation stereotypeAnnotation : stereotypeAnnotations)
- {
- // Retrieve and merge all metadata from stereotypes
- StereotypeModel<?> stereotype = manager.getServices().get(MetaDataCache.class).getStereotype(stereotypeAnnotation.annotationType());
- if (stereotype == null)
- {
- throw new IllegalStateException("Stereotype " + stereotypeAnnotation + " not registered with container");
- }
- if (stereotype.getDefaultDeploymentType() != null)
- {
- possibleDeploymentTypes.put(stereotype.getDefaultDeploymentType().annotationType(), stereotype.getDefaultDeploymentType());
- }
- if (stereotype.getDefaultScopeType() != null)
- {
- possibleScopeTypes.add(stereotype.getDefaultScopeType());
- }
- requiredTypes.addAll(stereotype.getRequiredTypes());
- supportedScopes.addAll(stereotype.getSupportedScopes());
- if (stereotype.isBeanNameDefaulted())
- {
- beanNameDefaulted = true;
- }
- }
- }
-
- /**
- * Returns the possible deployment typess
- *
- * @return The deployment types
- */
- public Map<Class<? extends Annotation>, Annotation> getPossibleDeploymentTypes()
- {
- return possibleDeploymentTypes;
- }
-
- /**
- * Returns the possible scope types
- *
- * @return The scope types
- */
- public Set<Annotation> getPossibleScopeTypes()
- {
- return possibleScopeTypes;
- }
-
- /**
- * Indicates if the name i defaulted
- *
- * @return True if defaulted, false if not
- */
- public boolean isBeanNameDefaulted()
- {
- return beanNameDefaulted;
- }
-
- /**
- * Returns the required types
- *
- * @return The required types
- */
- public Set<Class<?>> getRequiredTypes()
- {
- return requiredTypes;
- }
-
- /**
- * Returns the supported scopes
- *
- * @return The supported scopes
- */
- public Set<Class<? extends Annotation>> getSupportedScopes()
- {
- return supportedScopes;
- }
-
- /**
- * Indicates if the bean was declared in XML
- *
- * @return True if declared in XML, else false
- */
- public boolean isDeclaredInXml()
- {
- return false;
- }
-
- /**
- * Gets a string representation of the merged stereotypes
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- return "Merged stereotype model with possible deployment types " +
- possibleDeploymentTypes + ", required types " + requiredTypes +
- ", possible scopes " + possibleScopeTypes + " and supported scopes " + supportedScopes;
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MetaDataCache.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MetaDataCache.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MetaDataCache.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -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;
-
-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();
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/ScopeModel.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/ScopeModel.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/ScopeModel.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -1,89 +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;
-
-import java.lang.annotation.Annotation;
-
-import javax.enterprise.context.ScopeType;
-
-import org.jboss.webbeans.resources.ClassTransformer;
-
-/**
- *
- * Model of a scope
- *
- * @author Pete Muir
- *
- */
-public class ScopeModel<T extends Annotation> extends AnnotationModel<T>
-{
- /**
- * Constrctor
- *
- * @param scope The scope type
- */
- public ScopeModel(Class<T> scope, ClassTransformer classTransformer)
- {
- super(scope, classTransformer);
- }
-
- /**
- * Indicates if the scope is "normal"
- *
- * @return True if normal, false otherwise
- */
- public boolean isNormal()
- {
- return getAnnotatedAnnotation().getAnnotation(ScopeType.class).normal();
- }
-
- /**
- * Indicates if the scope is "passivating"
- *
- * @return True if passivating, false otherwise
- */
- public boolean isPassivating()
- {
- return getAnnotatedAnnotation().getAnnotation(ScopeType.class).passivating();
- }
-
- /**
- * Gets the corresponding meta-annotation type class
- *
- * @return The ScopeType class
- */
- @Override
- protected Class<? extends Annotation> getMetaAnnotation()
- {
- return ScopeType.class;
- }
-
- /**
- * Gets a string representation of the scope model
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- String valid = isValid() ? "Valid " : "Invalid";
- String normal = isNormal() ? "normal " : "non-normal ";
- String passivating = isPassivating() ? "passivating " : "pon-passivating ";
- return valid + normal + passivating + " scope model for " + getRawType();
- }
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/StereotypeModel.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/StereotypeModel.java 2009-06-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/StereotypeModel.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -1,259 +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;
-
-import java.lang.annotation.Annotation;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.enterprise.context.ScopeType;
-import javax.enterprise.inject.BindingType;
-import javax.enterprise.inject.Named;
-import javax.enterprise.inject.deployment.DeploymentType;
-import javax.enterprise.inject.stereotype.Stereotype;
-import javax.interceptor.InterceptorBindingType;
-
-import org.jboss.webbeans.DefinitionException;
-import org.jboss.webbeans.resources.ClassTransformer;
-
-/**
- * A meta model for a stereotype, allows us to cache a stereotype and to
- * validate it
- *
- * @author Pete Muir
- *
- */
-public class StereotypeModel<T extends Annotation> extends AnnotationModel<T>
-{
- // The default deployment type
- private Annotation defaultDeploymentType;
- // The default scope type
- private Annotation defaultScopeType;
- // Is the bean name defaulted
- private boolean beanNameDefaulted;
- // The supported scopes
- private Set<Class<? extends Annotation>> supportedScopes;
- // The required types
- private Set<Class<?>> requiredTypes;
- // The interceptor bindings
- private Set<Annotation> interceptorBindings;
-
- /**
- * Constructor
- *
- * @param sterotype The stereotype
- */
- public StereotypeModel(Class<T> sterotype, ClassTransformer transformer)
- {
- super(sterotype, transformer);
- initDefaultDeploymentType();
- initDefaultScopeType();
- initBeanNameDefaulted();
- initSupportedScopes();
- initRequiredTypes();
- initInterceptorBindings();
- checkBindings();
- }
-
- /**
- * Validates the binding types
- */
- private void checkBindings()
- {
- Set<Annotation> bindings = getAnnotatedAnnotation().getMetaAnnotations(BindingType.class);
- if (bindings.size() > 0)
- {
- throw new DefinitionException("Cannot declare binding types on a stereotype " + getAnnotatedAnnotation());
- }
- }
-
- /**
- * Initializes the interceptor bindings
- */
- private void initInterceptorBindings()
- {
- interceptorBindings = getAnnotatedAnnotation().getMetaAnnotations(InterceptorBindingType.class);
- }
-
- /**
- * 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()
- {
- if (getAnnotatedAnnotation().isAnnotationPresent(Named.class))
- {
- if (!"".equals(getAnnotatedAnnotation().getAnnotation(Named.class).value()))
- {
- throw new DefinitionException("Cannot specify a value for a @Named stereotype " + getAnnotatedAnnotation());
- }
- beanNameDefaulted = true;
- }
- }
-
- /**
- * Initializes the default scope type
- */
- private void initDefaultScopeType()
- {
- Set<Annotation> scopeTypes = getAnnotatedAnnotation().getMetaAnnotations(ScopeType.class);
- if (scopeTypes.size() > 1)
- {
- throw new DefinitionException("At most one scope type may be specified for " + getAnnotatedAnnotation());
- }
- else if (scopeTypes.size() == 1)
- {
- this.defaultScopeType = scopeTypes.iterator().next();
- }
- }
-
- /**
- * Initializes the default deployment type
- */
- private void initDefaultDeploymentType()
- {
- Set<Annotation> deploymentTypes = getAnnotatedAnnotation().getMetaAnnotations(DeploymentType.class);
- if (deploymentTypes.size() > 1)
- {
- throw new DefinitionException("At most one deployment type may be specified on " + getAnnotatedAnnotation());
- }
- else if (deploymentTypes.size() == 1)
- {
- this.defaultDeploymentType = deploymentTypes.iterator().next();
- }
- }
-
- /**
- * Get the default deployment type the stereotype specifies
- *
- * @return The default deployment type, or null if none is specified
- */
- public Annotation getDefaultDeploymentType()
- {
- return defaultDeploymentType;
- }
-
- /**
- * Get the default scope type the stereotype specifies
- *
- * @return The default scope type, or null if none is specified
- */
- public Annotation getDefaultScopeType()
- {
- return defaultScopeType;
- }
-
- /**
- * Get any interceptor bindings the the stereotype specifies
- *
- * @return The interceptor bindings, or an empty set if none are specified.
- */
- public Set<Annotation> getInterceptorBindings()
- {
- return interceptorBindings;
- }
-
- /**
- * Indicates if the bean name is defaulted
- *
- * @return True if defaulted, false otherwise
- */
- public boolean isBeanNameDefaulted()
- {
- return beanNameDefaulted;
- }
-
- /**
- * Gets the supported scopes
- *
- * @return A set of supported scopes, or an empty set if none are specified
- */
- public Set<Class<? extends Annotation>> getSupportedScopes()
- {
- return supportedScopes;
- }
-
- /**
- * Gets the required types
- *
- * @return A set of required types, or an empty set if none are specified
- */
- public Set<Class<?>> getRequiredTypes()
- {
- return requiredTypes;
- }
-
- /**
- * Gets the type
- *
- * @return The type
- */
- @Deprecated
- public Class<? extends Annotation> getStereotypeClass()
- {
- return getRawType();
- }
-
- /**
- * Gets a string representation of the stereotype
- *
- * @return The string representation
- */
- @Override
- public String toString()
- {
- return "Stereotype model with required types " + requiredTypes + " and supported scopes " + supportedScopes;
- }
-
- /**
- * Gets the meta-annotation type
- *
- * @return The Stereotype class
- */
- @Override
- protected Class<? extends Annotation> getMetaAnnotation()
- {
- return Stereotype.class;
- }
-
-}
Copied: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/AnnotationModel.java (from rev 2896, ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/AnnotationModel.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/AnnotationModel.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/AnnotationModel.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -0,0 +1,124 @@
+/*
+ * 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 org.jboss.webbeans.DefinitionException;
+import org.jboss.webbeans.introspector.WBAnnotation;
+import org.jboss.webbeans.resources.ClassTransformer;
+
+/**
+ * Abstract representation of an annotation model
+ *
+ * @author Pete Muir
+ */
+public abstract class AnnotationModel<T extends Annotation>
+{
+ // The underlying annotation
+ private WBAnnotation<T> annotatedAnnotation;
+ // Is the data valid?
+ private boolean valid;
+
+ /**
+ * Constructor
+ *
+ * @param type The annotation type
+ */
+ public AnnotationModel(Class<T> type, ClassTransformer transformer)
+ {
+ this.annotatedAnnotation = transformer.loadAnnotation(type);
+ init();
+ }
+
+ /**
+ * Initializes the type and validates it
+ */
+ protected void init()
+ {
+ initType();
+ initValid();
+ }
+
+ /**
+ * Initializes the type
+ */
+ protected void initType()
+ {
+ if (!Annotation.class.isAssignableFrom(getRawType()))
+ {
+ throw new DefinitionException(getMetaAnnotation().toString() + " can only be applied to an annotation, it was applied to " + getRawType());
+ }
+ }
+
+ /**
+ * Validates the data for correct annotation
+ */
+ protected void initValid()
+ {
+ this.valid = annotatedAnnotation.isAnnotationPresent(getMetaAnnotation());
+ }
+
+ /**
+ * Gets the type of the annotation
+ *
+ * @return The type
+ */
+ public Class<T> getRawType()
+ {
+ return annotatedAnnotation.getJavaClass();
+ }
+
+ /**
+ * Gets the meta-annotation that should be present
+ *
+ * @return
+ */
+ protected abstract Class<? extends Annotation> getMetaAnnotation();
+
+ /**
+ * Indicates if the annotation is valid
+ *
+ * @return True if valid, false otherwise
+ */
+ public boolean isValid()
+ {
+ return valid;
+ }
+
+ /**
+ * Gets the annotated annotation
+ *
+ * @return The annotation
+ */
+ protected WBAnnotation<T> getAnnotatedAnnotation()
+ {
+ return annotatedAnnotation;
+ }
+
+ /**
+ * Gets a string representation of the annotation model
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ return (isValid() ? "Valid" : "Invalid") + " annotation model for " + getRawType();
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/AnnotationModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/BindingTypeModel.java (from rev 2896, ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/BindingTypeModel.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/BindingTypeModel.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/BindingTypeModel.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -0,0 +1,174 @@
+/*
+ * 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.lang.reflect.InvocationTargetException;
+import java.util.Set;
+
+import javax.enterprise.inject.BindingType;
+import javax.enterprise.inject.NonBinding;
+
+import org.jboss.webbeans.DefinitionException;
+import org.jboss.webbeans.introspector.WBMethod;
+import org.jboss.webbeans.resources.ClassTransformer;
+import org.jboss.webbeans.util.Reflections;
+
+/**
+ *
+ * Model of a binding type
+ *
+ * @author Pete Muir
+ *
+ */
+public class BindingTypeModel<T extends Annotation> extends AnnotationModel<T>
+{
+ // The non-binding types
+ private Set<WBMethod<?>> nonBindingTypes;
+
+ /**
+ * Constructor
+ *
+ * @param type The type
+ */
+ public BindingTypeModel(Class<T> type, ClassTransformer transformer)
+ {
+ super(type, transformer);
+ }
+
+ /**
+ * Initializes the non-binding types and validates the members
+ */
+ @Override
+ protected void init()
+ {
+ super.init();
+ initNonBindingTypes();
+ checkArrayAndAnnotationValuedMembers();
+ }
+
+ /**
+ * Validates the members
+ */
+ private void checkArrayAndAnnotationValuedMembers()
+ {
+ for (WBMethod<?> annotatedMethod : getAnnotatedAnnotation().getMembers())
+ {
+ if ((Reflections.isArrayType(annotatedMethod.getJavaClass()) || Annotation.class.isAssignableFrom(annotatedMethod.getJavaClass())) && !nonBindingTypes.contains(annotatedMethod))
+ {
+ throw new DefinitionException("Member of array type or annotation type must be annotated @NonBinding " + annotatedMethod);
+ }
+ }
+
+ }
+
+ /**
+ * Gets the meta-annotation type
+ *
+ * @return The BindingType class
+ */
+ @Override
+ protected Class<? extends Annotation> getMetaAnnotation()
+ {
+ return BindingType.class;
+ }
+
+ /**
+ * Indicates if there are non-binding types present
+ *
+ * @return True if present, false otherwise
+ */
+ public boolean hasNonBindingTypes()
+ {
+ return nonBindingTypes.size() > 0;
+ }
+
+ /**
+ * Gets the non-binding types
+ *
+ * @return A set of non-binding types, or an empty set if there are none
+ * present
+ */
+ public Set<WBMethod<?>> getNonBindingTypes()
+ {
+ return nonBindingTypes;
+ }
+
+ /**
+ * Initializes the non-binding types
+ */
+ protected void initNonBindingTypes()
+ {
+ nonBindingTypes = getAnnotatedAnnotation().getAnnotatedMembers(NonBinding.class);
+ }
+
+ /**
+ * Comparator for checking equality
+ *
+ * @param instance The instance to check against
+ * @param other The other binding type
+ * @return True if equal, false otherwise
+ */
+ public boolean isEqual(Annotation instance, Annotation other)
+ {
+ if (instance.annotationType().equals(getRawType()) && other.annotationType().equals(getRawType()))
+ {
+ for (WBMethod<?> annotatedMethod : getAnnotatedAnnotation().getMembers())
+ {
+ if (!nonBindingTypes.contains(annotatedMethod))
+ {
+ try
+ {
+ Object thisValue = annotatedMethod.invoke(instance);
+ Object thatValue = annotatedMethod.invoke(other);
+ if (!thisValue.equals(thatValue))
+ {
+ return false;
+ }
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Gets a string representation of the binding type model
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ return (isValid() ? "Valid" : "Invalid") + " binding type model for " + getRawType() + " with non-binding types " + getNonBindingTypes();
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/BindingTypeModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MergedStereotypes.java (from rev 2896, ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MergedStereotypes.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MergedStereotypes.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MergedStereotypes.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -0,0 +1,167 @@
+/*
+ * 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.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.webbeans.BeanManagerImpl;
+
+/**
+ * Meta model for the merged stereotype for a bean
+ *
+ * @author Pete Muir
+ */
+public class MergedStereotypes<T, E>
+{
+ // The possible deployment types
+ private final Map<Class<? extends Annotation>, Annotation> possibleDeploymentTypes;
+ // The possible scope types
+ private final Set<Annotation> possibleScopeTypes;
+ // Is the bean name defaulted?
+ private boolean beanNameDefaulted;
+ // The required types
+ private final Set<Class<?>> requiredTypes;
+ // The supported scopes
+ private final Set<Class<? extends Annotation>> supportedScopes;
+
+ private final BeanManagerImpl manager;
+
+ /**
+ * Constructor
+ *
+ * @param stereotypeAnnotations The stereotypes to merge
+ */
+ public MergedStereotypes(Set<Annotation> stereotypeAnnotations, BeanManagerImpl manager)
+ {
+ this.possibleDeploymentTypes = new HashMap<Class<? extends Annotation>, Annotation>();
+ this.possibleScopeTypes = new HashSet<Annotation>();
+ this.requiredTypes = new HashSet<Class<?>>();
+ this.supportedScopes = new HashSet<Class<? extends Annotation>>();
+ this.manager = manager;
+ merge(stereotypeAnnotations);
+ }
+
+ /**
+ * Perform the merge
+ *
+ * @param stereotypeAnnotations The stereotype annotations
+ */
+ protected void merge(Set<Annotation> stereotypeAnnotations)
+ {
+ for (Annotation stereotypeAnnotation : stereotypeAnnotations)
+ {
+ // Retrieve and merge all metadata from stereotypes
+ StereotypeModel<?> stereotype = manager.getServices().get(MetaDataCache.class).getStereotype(stereotypeAnnotation.annotationType());
+ if (stereotype == null)
+ {
+ throw new IllegalStateException("Stereotype " + stereotypeAnnotation + " not registered with container");
+ }
+ if (stereotype.getDefaultDeploymentType() != null)
+ {
+ possibleDeploymentTypes.put(stereotype.getDefaultDeploymentType().annotationType(), stereotype.getDefaultDeploymentType());
+ }
+ if (stereotype.getDefaultScopeType() != null)
+ {
+ possibleScopeTypes.add(stereotype.getDefaultScopeType());
+ }
+ requiredTypes.addAll(stereotype.getRequiredTypes());
+ supportedScopes.addAll(stereotype.getSupportedScopes());
+ if (stereotype.isBeanNameDefaulted())
+ {
+ beanNameDefaulted = true;
+ }
+ }
+ }
+
+ /**
+ * Returns the possible deployment typess
+ *
+ * @return The deployment types
+ */
+ public Map<Class<? extends Annotation>, Annotation> getPossibleDeploymentTypes()
+ {
+ return possibleDeploymentTypes;
+ }
+
+ /**
+ * Returns the possible scope types
+ *
+ * @return The scope types
+ */
+ public Set<Annotation> getPossibleScopeTypes()
+ {
+ return possibleScopeTypes;
+ }
+
+ /**
+ * Indicates if the name i defaulted
+ *
+ * @return True if defaulted, false if not
+ */
+ public boolean isBeanNameDefaulted()
+ {
+ return beanNameDefaulted;
+ }
+
+ /**
+ * Returns the required types
+ *
+ * @return The required types
+ */
+ public Set<Class<?>> getRequiredTypes()
+ {
+ return requiredTypes;
+ }
+
+ /**
+ * Returns the supported scopes
+ *
+ * @return The supported scopes
+ */
+ public Set<Class<? extends Annotation>> getSupportedScopes()
+ {
+ return supportedScopes;
+ }
+
+ /**
+ * Indicates if the bean was declared in XML
+ *
+ * @return True if declared in XML, else false
+ */
+ public boolean isDeclaredInXml()
+ {
+ return false;
+ }
+
+ /**
+ * Gets a string representation of the merged stereotypes
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ return "Merged stereotype model with possible deployment types " +
+ possibleDeploymentTypes + ", required types " + requiredTypes +
+ ", possible scopes " + possibleScopeTypes + " and supported scopes " + supportedScopes;
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MergedStereotypes.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:mergeinfo
+
Copied: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MetaDataCache.java (from rev 2896, ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/MetaDataCache.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MetaDataCache.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MetaDataCache.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -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 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();
+ }
+
+}
Copied: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/ScopeModel.java (from rev 2896, ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/ScopeModel.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/ScopeModel.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/ScopeModel.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -0,0 +1,89 @@
+/*
+ * 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 javax.enterprise.context.ScopeType;
+
+import org.jboss.webbeans.resources.ClassTransformer;
+
+/**
+ *
+ * Model of a scope
+ *
+ * @author Pete Muir
+ *
+ */
+public class ScopeModel<T extends Annotation> extends AnnotationModel<T>
+{
+ /**
+ * Constrctor
+ *
+ * @param scope The scope type
+ */
+ public ScopeModel(Class<T> scope, ClassTransformer classTransformer)
+ {
+ super(scope, classTransformer);
+ }
+
+ /**
+ * Indicates if the scope is "normal"
+ *
+ * @return True if normal, false otherwise
+ */
+ public boolean isNormal()
+ {
+ return getAnnotatedAnnotation().getAnnotation(ScopeType.class).normal();
+ }
+
+ /**
+ * Indicates if the scope is "passivating"
+ *
+ * @return True if passivating, false otherwise
+ */
+ public boolean isPassivating()
+ {
+ return getAnnotatedAnnotation().getAnnotation(ScopeType.class).passivating();
+ }
+
+ /**
+ * Gets the corresponding meta-annotation type class
+ *
+ * @return The ScopeType class
+ */
+ @Override
+ protected Class<? extends Annotation> getMetaAnnotation()
+ {
+ return ScopeType.class;
+ }
+
+ /**
+ * Gets a string representation of the scope model
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ String valid = isValid() ? "Valid " : "Invalid";
+ String normal = isNormal() ? "normal " : "non-normal ";
+ String passivating = isPassivating() ? "passivating " : "pon-passivating ";
+ return valid + normal + passivating + " scope model for " + getRawType();
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/ScopeModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java (from rev 2896, ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/StereotypeModel.java)
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -0,0 +1,259 @@
+/*
+ * 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.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.ScopeType;
+import javax.enterprise.inject.BindingType;
+import javax.enterprise.inject.Named;
+import javax.enterprise.inject.deployment.DeploymentType;
+import javax.enterprise.inject.stereotype.Stereotype;
+import javax.interceptor.InterceptorBindingType;
+
+import org.jboss.webbeans.DefinitionException;
+import org.jboss.webbeans.resources.ClassTransformer;
+
+/**
+ * A meta model for a stereotype, allows us to cache a stereotype and to
+ * validate it
+ *
+ * @author Pete Muir
+ *
+ */
+public class StereotypeModel<T extends Annotation> extends AnnotationModel<T>
+{
+ // The default deployment type
+ private Annotation defaultDeploymentType;
+ // The default scope type
+ private Annotation defaultScopeType;
+ // Is the bean name defaulted
+ private boolean beanNameDefaulted;
+ // The supported scopes
+ private Set<Class<? extends Annotation>> supportedScopes;
+ // The required types
+ private Set<Class<?>> requiredTypes;
+ // The interceptor bindings
+ private Set<Annotation> interceptorBindings;
+
+ /**
+ * Constructor
+ *
+ * @param sterotype The stereotype
+ */
+ public StereotypeModel(Class<T> sterotype, ClassTransformer transformer)
+ {
+ super(sterotype, transformer);
+ initDefaultDeploymentType();
+ initDefaultScopeType();
+ initBeanNameDefaulted();
+ initSupportedScopes();
+ initRequiredTypes();
+ initInterceptorBindings();
+ checkBindings();
+ }
+
+ /**
+ * Validates the binding types
+ */
+ private void checkBindings()
+ {
+ Set<Annotation> bindings = getAnnotatedAnnotation().getMetaAnnotations(BindingType.class);
+ if (bindings.size() > 0)
+ {
+ throw new DefinitionException("Cannot declare binding types on a stereotype " + getAnnotatedAnnotation());
+ }
+ }
+
+ /**
+ * Initializes the interceptor bindings
+ */
+ private void initInterceptorBindings()
+ {
+ interceptorBindings = getAnnotatedAnnotation().getMetaAnnotations(InterceptorBindingType.class);
+ }
+
+ /**
+ * 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()
+ {
+ if (getAnnotatedAnnotation().isAnnotationPresent(Named.class))
+ {
+ if (!"".equals(getAnnotatedAnnotation().getAnnotation(Named.class).value()))
+ {
+ throw new DefinitionException("Cannot specify a value for a @Named stereotype " + getAnnotatedAnnotation());
+ }
+ beanNameDefaulted = true;
+ }
+ }
+
+ /**
+ * Initializes the default scope type
+ */
+ private void initDefaultScopeType()
+ {
+ Set<Annotation> scopeTypes = getAnnotatedAnnotation().getMetaAnnotations(ScopeType.class);
+ if (scopeTypes.size() > 1)
+ {
+ throw new DefinitionException("At most one scope type may be specified for " + getAnnotatedAnnotation());
+ }
+ else if (scopeTypes.size() == 1)
+ {
+ this.defaultScopeType = scopeTypes.iterator().next();
+ }
+ }
+
+ /**
+ * Initializes the default deployment type
+ */
+ private void initDefaultDeploymentType()
+ {
+ Set<Annotation> deploymentTypes = getAnnotatedAnnotation().getMetaAnnotations(DeploymentType.class);
+ if (deploymentTypes.size() > 1)
+ {
+ throw new DefinitionException("At most one deployment type may be specified on " + getAnnotatedAnnotation());
+ }
+ else if (deploymentTypes.size() == 1)
+ {
+ this.defaultDeploymentType = deploymentTypes.iterator().next();
+ }
+ }
+
+ /**
+ * Get the default deployment type the stereotype specifies
+ *
+ * @return The default deployment type, or null if none is specified
+ */
+ public Annotation getDefaultDeploymentType()
+ {
+ return defaultDeploymentType;
+ }
+
+ /**
+ * Get the default scope type the stereotype specifies
+ *
+ * @return The default scope type, or null if none is specified
+ */
+ public Annotation getDefaultScopeType()
+ {
+ return defaultScopeType;
+ }
+
+ /**
+ * Get any interceptor bindings the the stereotype specifies
+ *
+ * @return The interceptor bindings, or an empty set if none are specified.
+ */
+ public Set<Annotation> getInterceptorBindings()
+ {
+ return interceptorBindings;
+ }
+
+ /**
+ * Indicates if the bean name is defaulted
+ *
+ * @return True if defaulted, false otherwise
+ */
+ public boolean isBeanNameDefaulted()
+ {
+ return beanNameDefaulted;
+ }
+
+ /**
+ * Gets the supported scopes
+ *
+ * @return A set of supported scopes, or an empty set if none are specified
+ */
+ public Set<Class<? extends Annotation>> getSupportedScopes()
+ {
+ return supportedScopes;
+ }
+
+ /**
+ * Gets the required types
+ *
+ * @return A set of required types, or an empty set if none are specified
+ */
+ public Set<Class<?>> getRequiredTypes()
+ {
+ return requiredTypes;
+ }
+
+ /**
+ * Gets the type
+ *
+ * @return The type
+ */
+ @Deprecated
+ public Class<? extends Annotation> getStereotypeClass()
+ {
+ return getRawType();
+ }
+
+ /**
+ * Gets a string representation of the stereotype
+ *
+ * @return The string representation
+ */
+ @Override
+ public String toString()
+ {
+ return "Stereotype model with required types " + requiredTypes + " and supported scopes " + supportedScopes;
+ }
+
+ /**
+ * Gets the meta-annotation type
+ *
+ * @return The Stereotype class
+ */
+ @Override
+ protected Class<? extends Annotation> getMetaAnnotation()
+ {
+ return Stereotype.class;
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/resources/ClassTransformer.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -26,7 +26,7 @@
import org.jboss.webbeans.introspector.jlr.WBClassImpl;
import org.jboss.webbeans.util.collections.ConcurrentCache;
-public class ClassTransformer implements Service
+public class ClassTransformer implements Service
{
private final ConcurrentCache<Class<?>, WBClass<?>> classes;
@@ -42,30 +42,29 @@
annotations = new ConcurrentCache<Class<?>, WBAnnotation<?>>();
}
- public <T> WBClass<T> classForName(final Class<T> clazz)
+ public <T> WBClass<T> loadClass(final Class<T> clazz)
{
return classes.putIfAbsent(clazz, new Callable<WBClass<T>>()
- {
+ {
public WBClass<T> call() throws Exception
{
return WBClassImpl.of(clazz, transformer);
}
- });
+ });
}
- public <T extends Annotation> WBAnnotation<T> annotationTypeForName(final Class<T> clazz)
+ public <T extends Annotation> WBAnnotation<T> loadAnnotation(final Class<T> clazz)
{
return annotations.putIfAbsent(clazz, new Callable<WBAnnotation<T>>()
- {
-
+ {
public WBAnnotation<T> call() throws Exception
{
return WBAnnotationImpl.of(clazz, transformer);
}
- });
+ });
}
}
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-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -32,8 +32,8 @@
import org.jboss.webbeans.injection.FieldInjectionPoint;
import org.jboss.webbeans.introspector.WBClass;
import org.jboss.webbeans.introspector.WBField;
-import org.jboss.webbeans.metadata.BindingTypeModel;
-import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.BindingTypeModel;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
/**
* Helper class for bean inspection
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-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/context/PassivatingContextTest.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -6,7 +6,7 @@
import javax.enterprise.context.SessionScoped;
import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.webbeans.metadata.MetaDataCache;
+import org.jboss.webbeans.metadata.cache.MetaDataCache;
import org.testng.annotations.Test;
@Artifact
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-26 17:03:09 UTC (rev 2902)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/StereotypesTest.java 2009-06-26 17:12:22 UTC (rev 2903)
@@ -5,7 +5,7 @@
import javax.enterprise.context.RequestScoped;
import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.webbeans.metadata.StereotypeModel;
+import org.jboss.webbeans.metadata.cache.StereotypeModel;
import org.jboss.webbeans.resources.ClassTransformer;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;
More information about the weld-commits
mailing list