openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1681620 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Date Mon, 25 May 2015 17:27:26 GMT
Author: struberg
Date: Mon May 25 17:27:26 2015
New Revision: 1681620

URL: http://svn.apache.org/r1681620
Log:
OWB-798 improve performance of various event type checks

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java

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=1681620&r1=1681619&r2=1681620&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
Mon May 25 17:27:26 2015
@@ -140,6 +140,7 @@ import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
 import java.lang.reflect.WildcardType;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.EnumSet;
@@ -1252,45 +1253,56 @@ public final class WebBeansUtil
         }
     }
 
+    private final static Set<Type> EXTENSION_BEAN_EVENT_TYPES = new HashSet<Type>(
+        Arrays.asList(new Class[]{
+            GProcessAnnotatedType.class,
+            GProcessSyntheticAnnotatedType.class,
+            GProcessInjectionPoint.class,
+            GProcessInjectionTarget.class,
+            GProcessBeanAttributes.class,
+            GProcessManagedBean.class,
+            GProcessSessionBean.class,
+            GProcessBean.class}));
     public static boolean isExtensionBeanEventType(Type type)
     {
-        return type.equals(GProcessAnnotatedType.class) ||
-               type.equals(GProcessSyntheticAnnotatedType.class) ||
-               type.equals(GProcessInjectionPoint.class) ||
-               type.equals(GProcessInjectionTarget.class) ||
-               type.equals(GProcessBeanAttributes.class) ||
-               type.equals(GProcessManagedBean.class) ||
-               type.equals(GProcessSessionBean.class) ||
-               type.equals(GProcessBean.class);
+        return EXTENSION_BEAN_EVENT_TYPES.contains(type);
     }
 
+    private final static Set<Type> DEFAULT_EXTENSION_BEAN_EVENT_TYPE = new HashSet<Type>(
+        Arrays.asList(new Class[]{
+            ProcessAnnotatedType.class,
+            ProcessSyntheticAnnotatedType.class,
+            ProcessInjectionPoint.class,
+            ProcessInjectionTarget.class,
+            ProcessBeanAttributes.class,
+            ProcessManagedBean.class,
+            ProcessBean.class,
+            ProcessSessionBean.class}));
     public static boolean isDefaultExtensionBeanEventType(Class<?> clazz)
     {
-        return clazz.equals(ProcessAnnotatedType.class) ||
-               clazz.equals(ProcessSyntheticAnnotatedType.class) ||
-               clazz.equals(ProcessInjectionPoint.class) ||
-               clazz.equals(ProcessInjectionTarget.class) ||
-               clazz.equals(ProcessBeanAttributes.class) ||
-               clazz.equals(ProcessManagedBean.class) ||
-               clazz.equals(ProcessBean.class) ||
-               clazz.equals(ProcessSessionBean.class);
+        return DEFAULT_EXTENSION_BEAN_EVENT_TYPE.contains(clazz);
     }
 
+    private final static Set<Type> EXTENSION_PRODUCER_OR_OBSERVER_EVENT_TYPE = new
HashSet<Type>(
+        Arrays.asList(new Class[]{
+            GProcessProducer.class,
+            GProcessProducerField.class,
+            GProcessProducerMethod.class,
+            GProcessObservableMethod.class}));
     public static boolean isExtensionProducerOrObserverEventType(Type type)
     {
-        return type.equals(GProcessProducer.class) ||
-               type.equals(GProcessProducerField.class) ||
-               type.equals(GProcessProducerMethod.class) ||
-               type.equals(GProcessObservableMethod.class);
+        return EXTENSION_PRODUCER_OR_OBSERVER_EVENT_TYPE.contains(type);
     }
 
+    private final static Set<Type> DEFAULT_EXTENSION_PRODUCER_OR_OBSERVER_EVENT_TYPE
= new HashSet<Type>(
+        Arrays.asList(new Class[]{
+            ProcessProducer.class,
+            ProcessProducerField.class,
+            ProcessProducerMethod.class,
+            ProcessObserverMethod.class}));
     public static boolean isDefaultExtensionProducerOrObserverEventType(Class<?> clazz)
     {
-        return clazz.equals(ProcessProducer.class) ||
-               clazz.equals(ProcessProducerField.class) ||
-               clazz.equals(ProcessProducerMethod.class) ||
-               clazz.equals(ProcessObserverMethod.class);
-
+        return DEFAULT_EXTENSION_PRODUCER_OR_OBSERVER_EVENT_TYPE.contains(clazz);
     }
 
     public static boolean isDependent(Bean<?> bean)



Mime
View raw message