openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1442766 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: component/third/ config/ corespi/se/ decorator/ inject/instance/ plugins/ util/
Date Tue, 05 Feb 2013 22:20:56 GMT
Author: struberg
Date: Tue Feb  5 22:20:56 2013
New Revision: 1442766

URL: http://svn.apache.org/viewvc?rev=1442766&view=rev
Log:
OWB-344 simplify and cleanup code

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeanTypeSetResolver.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/PluginLoader.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java?rev=1442766&r1=1442765&r2=1442766&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
Tue Feb  5 22:20:56 2013
@@ -85,7 +85,7 @@ public class ThirdpartyBeanImpl<T> exten
     @Override
     public boolean isPassivationCapable()
     {
-        return bean instanceof PassivationCapable ? true : false;
+        return bean instanceof PassivationCapable;
     }
 
     @Override

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeanTypeSetResolver.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeanTypeSetResolver.java?rev=1442766&r1=1442765&r2=1442766&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeanTypeSetResolver.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeanTypeSetResolver.java
Tue Feb  5 22:20:56 2013
@@ -57,8 +57,7 @@ public class BeanTypeSetResolver
             if(beanType instanceof Class)
             {
                 normalClassConfiguration((Class<?>) beanType);
-   
-            }            
+            }
         }
     }
     

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java?rev=1442766&r1=1442765&r2=1442766&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/DefaultContextsService.java
Tue Feb  5 22:20:56 2013
@@ -189,18 +189,12 @@ public class DefaultContextsService exte
     public boolean supportsContext(Class<? extends Annotation> scopeType)
     {
         
-        if(scopeType.equals(RequestScoped.class) ||
-                scopeType.equals(SessionScoped.class) ||
-                scopeType.equals(ApplicationScoped.class) ||
-                scopeType.equals(ConversationScoped.class) ||
-                scopeType.equals(Dependent.class) ||
-                scopeType.equals(Singleton.class))
-        {
-            return true;
-        }
-        
-        return false;
-
+        return scopeType.equals(RequestScoped.class) ||
+               scopeType.equals(SessionScoped.class) ||
+               scopeType.equals(ApplicationScoped.class) ||
+               scopeType.equals(ConversationScoped.class) ||
+               scopeType.equals(Dependent.class) ||
+               scopeType.equals(Singleton.class);
     }
 
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java?rev=1442766&r1=1442765&r2=1442766&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
Tue Feb  5 22:20:56 2013
@@ -225,12 +225,7 @@ public class DecoratorsManager
             }
         }
 
-        if(ok)
-        {
-            return true;
-        }
-
-        return false;
+        return ok;
     }
 
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java?rev=1442766&r1=1442765&r2=1442766&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
Tue Feb  5 22:20:56 2013
@@ -168,7 +168,7 @@ public class InstanceImpl<T> implements 
     {
         Set<Bean<?>> beans = resolveBeans();
         
-        return beans.size() > 1 ? true : false;
+        return beans.size() > 1;
     }
 
     /**
@@ -178,7 +178,7 @@ public class InstanceImpl<T> implements 
     {
         Set<Bean<?>> beans = resolveBeans();
         
-        return beans.size() == 0 ? true : false;
+        return beans.size() == 0;
     }
 
     /**

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/PluginLoader.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/PluginLoader.java?rev=1442766&r1=1442765&r2=1442766&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/PluginLoader.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/plugins/PluginLoader.java
Tue Feb  5 22:20:56 2013
@@ -270,11 +270,6 @@ public class PluginLoader
     
     private boolean pluginsExist()
     {
-        if(plugins == null)
-        {
-            return false;
-        }
-        
-        return true;
+        return plugins == null && plugins.size() > 0;
     }
 }

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=1442766&r1=1442765&r2=1442766&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
Tue Feb  5 22:20:56 2013
@@ -1351,11 +1351,7 @@ public final class WebBeansUtil
             isAlternative =  at.getAnnotation(Alternative.class) != null;
         }
         
-        if(isAlternative && !webBeansContext.getAlternativesManager().isAlternative(beanType,
stereotypes))
-        {
-            return false;
-        }
-        return true;
+        return !isAlternative || webBeansContext.getAlternativesManager().isAlternative(beanType,
stereotypes);
     }
 
     public static boolean hasInjectionTargetBeanAnnotatedWithAlternative(InjectionTargetBean<?>
bean)
@@ -1434,84 +1430,53 @@ public final class WebBeansUtil
 
     public static boolean isExtensionEventType(Class<?> clazz)
     {
-        if(clazz.equals(BeforeBeanDiscovery.class) ||
-                clazz.equals(AfterBeanDiscovery.class) ||
-                clazz.equals(AfterDeploymentValidation.class) ||
-                clazz.equals(BeforeShutdown.class) ||
-                clazz.equals(GProcessAnnotatedType.class) ||
-                clazz.equals(GProcessInjectionTarget.class) ||
-                clazz.equals(GProcessProducer.class) ||
-                clazz.equals(GProcessProducerField.class) ||
-                clazz.equals(GProcessProducerMethod.class) ||
-                clazz.equals(GProcessManagedBean.class) ||
-                clazz.equals(GProcessBean.class) ||
-                clazz.equals(GProcessSessionBean.class) ||
-                clazz.equals(GProcessObservableMethod.class)
-                )
-        {
-            return true;
-        }
-
-        return false;
+        return clazz.equals(BeforeBeanDiscovery.class) ||
+               clazz.equals(AfterBeanDiscovery.class) ||
+               clazz.equals(AfterDeploymentValidation.class) ||
+               clazz.equals(BeforeShutdown.class) ||
+               clazz.equals(GProcessAnnotatedType.class) ||
+               clazz.equals(GProcessInjectionTarget.class) ||
+               clazz.equals(GProcessProducer.class) ||
+               clazz.equals(GProcessProducerField.class) ||
+               clazz.equals(GProcessProducerMethod.class) ||
+               clazz.equals(GProcessManagedBean.class) ||
+               clazz.equals(GProcessBean.class) ||
+               clazz.equals(GProcessSessionBean.class) ||
+               clazz.equals(GProcessObservableMethod.class);
     }
 
     public static boolean isExtensionBeanEventType(Class<?> clazz)
     {
-        if(clazz.equals(GProcessAnnotatedType.class) ||
-                clazz.equals(GProcessInjectionTarget.class) ||
-                clazz.equals(GProcessManagedBean.class) ||
-                clazz.equals(GProcessSessionBean.class) ||
-                clazz.equals(GProcessBean.class)
-                )
-        {
-            return true;
-        }
-
-        return false;
+        return clazz.equals(GProcessAnnotatedType.class) ||
+               clazz.equals(GProcessInjectionTarget.class) ||
+               clazz.equals(GProcessManagedBean.class) ||
+               clazz.equals(GProcessSessionBean.class) ||
+               clazz.equals(GProcessBean.class);
     }
 
     public static boolean isDefaultExtensionBeanEventType(Class<?> clazz)
     {
-        if(clazz.equals(ProcessAnnotatedType.class) ||
-                clazz.equals(ProcessInjectionTarget.class) ||
-                clazz.equals(ProcessManagedBean.class) ||
-                clazz.equals(ProcessBean.class) ||
-                clazz.equals(ProcessSessionBean.class)
-                )
-        {
-            return true;
-        }
-
-        return false;
+        return clazz.equals(ProcessAnnotatedType.class) ||
+               clazz.equals(ProcessInjectionTarget.class) ||
+               clazz.equals(ProcessManagedBean.class) ||
+               clazz.equals(ProcessBean.class) ||
+               clazz.equals(ProcessSessionBean.class);
     }
 
     public static boolean isExtensionProducerOrObserverEventType(Class<?> clazz)
     {
-        if(clazz.equals(GProcessProducer.class) ||
-                clazz.equals(GProcessProducerField.class) ||
-                clazz.equals(GProcessProducerMethod.class) ||
-                clazz.equals(GProcessObservableMethod.class)
-                )
-        {
-            return true;
-        }
-
-        return false;
-
+        return clazz.equals(GProcessProducer.class) ||
+               clazz.equals(GProcessProducerField.class) ||
+               clazz.equals(GProcessProducerMethod.class) ||
+               clazz.equals(GProcessObservableMethod.class);
     }
 
     public static boolean isDefaultExtensionProducerOrObserverEventType(Class<?> clazz)
     {
-        if(clazz.equals(ProcessProducer.class) ||
-                clazz.equals(ProcessProducerField.class) ||
-                clazz.equals(ProcessProducerMethod.class) ||
-                clazz.equals(ProcessObserverMethod.class)
-                )
-        {
-            return true;
-        }
-
-        return false;
+        return clazz.equals(ProcessProducer.class) ||
+               clazz.equals(ProcessProducerField.class) ||
+               clazz.equals(ProcessProducerMethod.class) ||
+               clazz.equals(ProcessObserverMethod.class);
 
     }
 
@@ -1519,12 +1484,7 @@ public final class WebBeansUtil
     {
         if(!(bean instanceof OwbBean))
         {
-            if(bean.getScope().equals(Dependent.class))
-            {
-                return true;
-            }
-
-            return false;
+            return bean.getScope().equals(Dependent.class);
         }
 
         return ((OwbBean) bean).isDependent();



Mime
View raw message