You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2010/07/27 22:19:27 UTC
svn commit: r979840 -
/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java
Author: struberg
Date: Tue Jul 27 20:19:27 2010
New Revision: 979840
URL: http://svn.apache.org/viewvc?rev=979840&view=rev
Log:
OWB-427 performance improvement of often used methods
txs to Gerhard Petracek for the patch!
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java?rev=979840&r1=979839&r2=979840&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractOwbBean.java Tue Jul 27 20:19:27 2010
@@ -61,6 +61,9 @@ public abstract class AbstractOwbBean<T>
/** Scope type of the bean */
protected Annotation implScopeType;
+ /** Cached scope type of the bean */
+ protected Class<? extends Annotation> scopeClass;
+
/** Qualifiers of the bean */
protected Set<Annotation> implQualifiers = new HashSet<Annotation>();
@@ -75,7 +78,10 @@ public abstract class AbstractOwbBean<T>
/** Stereotypes of the bean */
protected Set<Annotation> stereoTypes = new HashSet<Annotation>();
-
+
+ /** this is only for public access and will be built from {@link #stereoTypes} on demand */
+ protected Set<Class<? extends Annotation>> stereoTypeClasses = null;
+
/**This bean is specialized or not*/
protected boolean specializedBean;
@@ -332,6 +338,7 @@ public abstract class AbstractOwbBean<T>
public void setImplScopeType(Annotation scopeType)
{
this.implScopeType = scopeType;
+ this.scopeClass = this.implScopeType.annotationType();
}
/**
@@ -361,6 +368,8 @@ public abstract class AbstractOwbBean<T>
*/
public void addStereoType(Annotation stereoType)
{
+ this.stereoTypeClasses = null; // will get rebuilt on the next request
+
this.stereoTypes.add(stereoType);
}
@@ -438,7 +447,7 @@ public abstract class AbstractOwbBean<T>
@Override
public Class<? extends Annotation> getScope()
{
- return this.implScopeType.annotationType();
+ return this.scopeClass;
}
@@ -558,14 +567,18 @@ public abstract class AbstractOwbBean<T>
*/
public Set<Class<? extends Annotation>> getStereotypes()
{
- Set<Class<? extends Annotation>> set = new HashSet<Class<? extends Annotation>>();
-
- for(Annotation ann : this.stereoTypes)
+ if (stereoTypeClasses == null)
{
- set.add(ann.annotationType());
+ Set<Class<? extends Annotation>> set = new HashSet<Class<? extends Annotation>>();
+
+ for(Annotation ann : this.stereoTypes)
+ {
+ set.add(ann.annotationType());
+ }
+ stereoTypeClasses = set;
}
-
- return set;
+
+ return stereoTypeClasses;
}
/**