Author: arne
Date: Sat Jan 5 16:14:16 2013
New Revision: 1429324
URL: http://svn.apache.org/viewvc?rev=1429324&view=rev
Log:
OWB-745: Moved methods to WebBeansUtil
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=1429324&r1=1429323&r2=1429324&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
Sat Jan 5 16:14:16 2013
@@ -826,10 +826,10 @@ public class BeansDeployer
}
//Check for whether this class is candidate for Managed Bean
- if (webBeansContext.getManagedBeanConfigurator().isManagedBean(clazz))
+ if (webBeansContext.getWebBeansUtil().isManagedBean(clazz))
{
//Check conditions
-
webBeansContext.getManagedBeanConfigurator().checkManagedBeanCondition(clazz);
+ webBeansContext.getWebBeansUtil().checkManagedBeanCondition(clazz);
ManagedBeanCreatorImpl<T> managedBeanCreator = new
ManagedBeanCreatorImpl<T>(annotatedType, webBeansContext);
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java?rev=1429324&r1=1429323&r2=1429324&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
Sat Jan 5 16:14:16 2013
@@ -57,49 +57,6 @@ public final class ManagedBeanConfigurat
this.webBeansContext = webBeansContext;
}
- public void checkManagedBeanCondition(Class<?> clazz) throws
WebBeansConfigurationException
- {
- int modifier = clazz.getModifiers();
-
- if (AnnotationUtil.hasClassAnnotation(clazz, Decorator.class) &&
AnnotationUtil.hasClassAnnotation(clazz, Interceptor.class))
- {
- throw new WebBeansConfigurationException("ManagedBean
implementation class : " + clazz.getName()
- + " may not annotated
with both @Interceptor and @Decorator annotation");
- }
-
- if (!AnnotationUtil.hasClassAnnotation(clazz, Decorator.class) &&
!AnnotationUtil.hasClassAnnotation(clazz, Interceptor.class))
- {
-
webBeansContext.getInterceptorUtil().checkSimpleWebBeansInterceptorConditions(clazz);
- }
-
- if (Modifier.isInterface(modifier))
- {
- throw new WebBeansConfigurationException("ManagedBean
implementation class : " + clazz.getName() + " may not _defined as interface");
- }
- }
-
- /**
- * Returns true if this class can be candidate for simple web bean, false
otherwise.
- *
- * @param clazz implementation class
- * @return true if this class can be candidate for simple web bean
- * @throws WebBeansConfigurationException if any configuration exception
occurs
- */
- public boolean isManagedBean(Class<?> clazz) throws
WebBeansConfigurationException
- {
- try
- {
- webBeansContext.getWebBeansUtil().isManagedBeanClass(clazz);
-
- }
- catch (WebBeansConfigurationException e)
- {
- return false;
- }
-
- return true;
- }
-
/**
* Returns the newly created Simple WebBean Component.
*
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=1429324&r1=1429323&r2=1429324&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Sat Jan 5 16:14:16 2013
@@ -315,6 +315,28 @@ public final class WebBeansUtil
}
/**
+ * Returns true if this class can be candidate for simple web bean, false
otherwise.
+ *
+ * @param clazz implementation class
+ * @return true if this class can be candidate for simple web bean
+ * @throws WebBeansConfigurationException if any configuration exception
occurs
+ */
+ public boolean isManagedBean(Class<?> clazz) throws
WebBeansConfigurationException
+ {
+ try
+ {
+ isManagedBeanClass(clazz);
+
+ }
+ catch (WebBeansConfigurationException e)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
* Return <code>true</code> if the given class is ok for manage bean
conditions,
* <code>false</code> otherwise.
*
@@ -379,6 +401,27 @@ public final class WebBeansUtil
}
}
+ public void checkManagedBeanCondition(Class<?> clazz) throws
WebBeansConfigurationException
+ {
+ int modifier = clazz.getModifiers();
+
+ if (AnnotationUtil.hasClassAnnotation(clazz, Decorator.class) &&
AnnotationUtil.hasClassAnnotation(clazz, javax.interceptor.Interceptor.class))
+ {
+ throw new WebBeansConfigurationException("ManagedBean
implementation class : " + clazz.getName()
+ + " may not annotated
with both @Interceptor and @Decorator annotation");
+ }
+
+ if (!AnnotationUtil.hasClassAnnotation(clazz, Decorator.class) &&
!AnnotationUtil.hasClassAnnotation(clazz, javax.interceptor.Interceptor.class))
+ {
+
webBeansContext.getInterceptorUtil().checkSimpleWebBeansInterceptorConditions(clazz);
+ }
+
+ if (Modifier.isInterface(modifier))
+ {
+ throw new WebBeansConfigurationException("ManagedBean
implementation class : " + clazz.getName() + " may not _defined as interface");
+ }
+ }
+
/**
* Returns true if given class supports injections,
* false otherwise.
@@ -578,7 +621,7 @@ public final class WebBeansUtil
DefinitionUtil definitionUtil = webBeansContext.getDefinitionUtil();
- if (webBeansContext.getManagedBeanConfigurator().isManagedBean(clazz))
+ if (webBeansContext.getWebBeansUtil().isManagedBean(clazz))
{
comp = new NewManagedBean<T>(clazz, WebBeansType.MANAGED,
webBeansContext.getAnnotatedElementFactory().newAnnotatedType(clazz),
webBeansContext);
comp.setImplScopeType(new DependentScopeLiteral());
Modified:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java?rev=1429324&r1=1429323&r2=1429324&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
Sat Jan 5 16:14:16 2013
@@ -292,7 +292,7 @@ public abstract class TestContext implem
ManagedBean<T> component = null;
WebBeansContext webBeansContext = WebBeansContext.getInstance();
-
webBeansContext.getManagedBeanConfigurator().checkManagedBeanCondition(clazz);
+ webBeansContext.getWebBeansUtil().checkManagedBeanCondition(clazz);
webBeansContext.getInterceptorsManager().addNewInterceptorClass(clazz);
AnnotatedType annotatedType =
webBeansContext.getAnnotatedElementFactory().newAnnotatedType(clazz);