You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by si...@apache.org on 2010/01/14 04:16:53 UTC
svn commit: r899040 -
/labs/magma/trunk/foundation-beans/src/main/java/org/apache/magma/beans/BeanData.java
Author: simoneg
Date: Thu Jan 14 03:16:51 2010
New Revision: 899040
URL: http://svn.apache.org/viewvc?rev=899040&view=rev
Log:
Support contextualization in bean data creation
Modified:
labs/magma/trunk/foundation-beans/src/main/java/org/apache/magma/beans/BeanData.java
Modified: labs/magma/trunk/foundation-beans/src/main/java/org/apache/magma/beans/BeanData.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-beans/src/main/java/org/apache/magma/beans/BeanData.java?rev=899040&r1=899039&r2=899040&view=diff
==============================================================================
--- labs/magma/trunk/foundation-beans/src/main/java/org/apache/magma/beans/BeanData.java (original)
+++ labs/magma/trunk/foundation-beans/src/main/java/org/apache/magma/beans/BeanData.java Thu Jan 14 03:16:51 2010
@@ -27,6 +27,7 @@
import java.util.Set;
import org.apache.magma.basics.MagmaException;
+import org.apache.magma.basics.context.RunningContext;
/**
* Holds informations about a bean. The bean is inspected only once, and various components
@@ -75,18 +76,28 @@
*/
@SuppressWarnings("unchecked")
private BeanData(Class clazz) {
- this.beanClass = clazz;
- BeanInfo beanInfo = null;
+ RunningContext.get().push(clazz);
try {
- beanInfo = Introspector.getBeanInfo(clazz);
- } catch (IntrospectionException e) {
- throw new IllegalStateException("Error analyzing bean " + clazz, e);
- }
- PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
- for (PropertyDescriptor desc : descriptors) {
- PropertyInfo info = new PropertyInfo();
- info.init(desc, clazz);
- properties.put(info.getName(), info);
+ this.beanClass = clazz;
+ BeanInfo beanInfo = null;
+ try {
+ beanInfo = Introspector.getBeanInfo(clazz);
+ } catch (IntrospectionException e) {
+ throw new IllegalStateException("Error analyzing bean " + clazz, e);
+ }
+ PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
+ for (PropertyDescriptor desc : descriptors) {
+ RunningContext.get().push(desc.getName());
+ try {
+ PropertyInfo info = new PropertyInfo();
+ info.init(desc, clazz);
+ properties.put(info.getName(), info);
+ } finally {
+ RunningContext.get().popString();
+ }
+ }
+ } finally {
+ RunningContext.get().popClass();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org