Author: pete.muir(a)jboss.org
Date: 2009-06-28 11:48:12 -0400 (Sun, 28 Jun 2009)
New Revision: 2915
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.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/tests/src/test/java/org/jboss/webbeans/test/unit/definition/StereotypesTest.java
Log:
Actually remove stereotypes requiredTypes/supportedScopes
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:17:17 UTC (rev 2914)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-06-28
15:48:12 UTC (rev 2915)
@@ -161,7 +161,6 @@
initScopeType();
initSerializable();
initProxyable();
- checkRequiredTypesImplemented();
initInjectionPoints();
initDecorates();
checkDecorates();
@@ -348,22 +347,6 @@
}
}
- /**
- * Validates that the required types are implemented
- */
- protected void checkRequiredTypesImplemented()
- {
- for (Class<?> requiredType : getMergedStereotypes().getRequiredTypes())
- {
- if (log.isTraceEnabled())
- log.trace("Checking if required type " + requiredType + " is
implemented");
- if (!requiredType.isAssignableFrom(type))
- {
- throw new DefinitionException("Required type " + requiredType +
" isn't implemented on " + type);
- }
- }
- }
-
protected void postSpecialize()
{
if (getAnnotatedItem().isAnnotationPresent(Named.class) &&
getSpecializedBean().getAnnotatedItem().isAnnotationPresent(Named.class))
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-06-28
15:17:17 UTC (rev 2914)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-06-28
15:48:12 UTC (rev 2915)
@@ -114,7 +114,6 @@
{
initInitializerMethods();
super.initialize(environment);
- checkScopeAllowed();
checkBeanImplementation();
initDecorators();
checkType();
@@ -362,22 +361,6 @@
}
/**
- * Validate that the scope type is allowed by the stereotypes on the bean and
- * the bean type
- */
- protected void checkScopeAllowed()
- {
- log.trace("Checking if " + getScopeType() + " is allowed for "
+ type);
- if (getMergedStereotypes().getSupportedScopes().size() > 0)
- {
- if (!getMergedStereotypes().getSupportedScopes().contains(getScopeType()))
- {
- throw new DefinitionException("Scope " + getScopeType() + " is
not an allowed by the stereotype for " + type);
- }
- }
- }
-
- /**
* Validates the bean implementation
*/
protected void checkBeanImplementation() {}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-06-28
15:17:17 UTC (rev 2914)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-06-28
15:48:12 UTC (rev 2915)
@@ -124,6 +124,7 @@
checkEJBTypeAllowed();
checkConflictingRoles();
checkObserverMethods();
+ checkScopeAllowed();
}
}
@@ -172,10 +173,8 @@
* Check that the scope type is allowed by the stereotypes on the bean and
* the bean type
*/
- @Override
protected void checkScopeAllowed()
{
- super.checkScopeAllowed();
if (ejbDescriptor.isStateless() && !isDependent())
{
throw new DefinitionException("Scope " + getScopeType() + " is
not allowed on stateless enterpise beans for " + getType() + ". Only @Dependent
is allowed on stateless enterprise beans");
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java 2009-06-28
15:17:17 UTC (rev 2914)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/NewSimpleBean.java 2009-06-28
15:48:12 UTC (rev 2915)
@@ -110,10 +110,4 @@
return false;
}
- @Override
- protected void checkScopeAllowed()
- {
- // No-op
- }
-
}
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:17:17 UTC (rev 2914)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/MergedStereotypes.java 2009-06-28
15:48:12 UTC (rev 2915)
@@ -37,10 +37,6 @@
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;
@@ -53,8 +49,6 @@
{
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);
}
@@ -82,8 +76,6 @@
{
possibleScopeTypes.add(stereotype.getDefaultScopeType());
}
- requiredTypes.addAll(stereotype.getRequiredTypes());
- supportedScopes.addAll(stereotype.getSupportedScopes());
if (stereotype.isBeanNameDefaulted())
{
beanNameDefaulted = true;
@@ -122,26 +114,6 @@
}
/**
- * 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
@@ -160,8 +132,7 @@
public String toString()
{
return "Merged stereotype model with possible deployment types " +
- possibleDeploymentTypes + ", required types " + requiredTypes +
- ", possible scopes " + possibleScopeTypes + " and supported scopes
" + supportedScopes;
+ possibleDeploymentTypes + " and possible scopes " + possibleScopeTypes;
}
}
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:17:17 UTC (rev 2914)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/metadata/cache/StereotypeModel.java 2009-06-28
15:48:12 UTC (rev 2915)
@@ -44,10 +44,6 @@
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;
@@ -174,48 +170,6 @@
}
/**
- * 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
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:17:17 UTC (rev 2914)
+++
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/definition/StereotypesTest.java 2009-06-28
15:48:12 UTC (rev 2915)
@@ -1,7 +1,5 @@
package org.jboss.webbeans.test.unit.definition;
-import java.util.Arrays;
-
import javax.enterprise.context.RequestScoped;
import org.jboss.testharness.impl.packaging.Artifact;
@@ -23,9 +21,6 @@
StereotypeModel<AnimalStereotype> animalStereotype = new
StereotypeModel<AnimalStereotype>(AnimalStereotype.class, transformer);
assert
animalStereotype.getDefaultScopeType().annotationType().equals(RequestScoped.class);
assert animalStereotype.getInterceptorBindings().size() == 0;
- assert animalStereotype.getRequiredTypes().size() == 1;
- assert animalStereotype.getRequiredTypes().contains(Animal.class);
- assert animalStereotype.getSupportedScopes().size() == 0;
assert !animalStereotype.isBeanNameDefaulted();
assert animalStereotype.getDefaultDeploymentType() == null;
}
@@ -36,10 +31,6 @@
StereotypeModel<AnimalOrderStereotype> animalStereotype = new
StereotypeModel<AnimalOrderStereotype>(AnimalOrderStereotype.class, transformer);
assert animalStereotype.getDefaultScopeType() == null;
assert animalStereotype.getInterceptorBindings().size() == 0;
- assert animalStereotype.getRequiredTypes().size() == 2;
- Class<?> [] requiredTypes = {Animal.class, Order.class};
- assert
animalStereotype.getRequiredTypes().containsAll(Arrays.asList(requiredTypes));
- assert animalStereotype.getSupportedScopes().size() == 0;
assert !animalStereotype.isBeanNameDefaulted();
assert animalStereotype.getDefaultDeploymentType() == null;
}
@@ -50,10 +41,6 @@
StereotypeModel<RequestScopedAnimalStereotype> animalStereotype = new
StereotypeModel<RequestScopedAnimalStereotype>(RequestScopedAnimalStereotype.class,
transformer);
assert animalStereotype.getDefaultScopeType() == null;
assert animalStereotype.getInterceptorBindings().size() == 0;
- assert animalStereotype.getRequiredTypes().size() == 1;
- assert Animal.class.equals(animalStereotype.getRequiredTypes().iterator().next());
- assert animalStereotype.getSupportedScopes().size() == 1;
- assert animalStereotype.getSupportedScopes().contains(RequestScoped.class);
assert !animalStereotype.isBeanNameDefaulted();
assert animalStereotype.getDefaultDeploymentType() == null;
}