[seam-commits] Seam SVN: r9910 - trunk/src/wicket/org/jboss/seam/wicket.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Sat Jan 10 09:18:32 EST 2009


Author: cpopetz
Date: 2009-01-10 09:18:32 -0500 (Sat, 10 Jan 2009)
New Revision: 9910

Modified:
   trunk/src/wicket/org/jboss/seam/wicket/WicketComponent.java
Log:
JBSEAM-3880

Modified: trunk/src/wicket/org/jboss/seam/wicket/WicketComponent.java
===================================================================
--- trunk/src/wicket/org/jboss/seam/wicket/WicketComponent.java	2009-01-09 19:39:49 UTC (rev 9909)
+++ trunk/src/wicket/org/jboss/seam/wicket/WicketComponent.java	2009-01-10 14:18:32 UTC (rev 9910)
@@ -424,8 +424,9 @@
       }
    }
    
-   private static Object getValue(BijectedAttribute<In> in, Object bean)
+   private Object getValue(BijectedAttribute<In> in, Object bean)
    {
+      Object result;
       String name = in.getContextVariableName();
       if ( name.startsWith("#") )
       {
@@ -433,7 +434,7 @@
          {
             log.trace("trying to inject with EL expression: " + name);
          }
-         return Expressions.instance().createValueExpression(name).getValue();
+         result = Expressions.instance().createValueExpression(name).getValue();
       }
       else if ( in.getAnnotation().scope()==UNSPECIFIED )
       {
@@ -441,7 +442,8 @@
          {
             log.trace("trying to inject with hierarchical context search: " + name);
          }
-         return getInstanceInAllNamespaces(name, in.getAnnotation().create());
+         boolean create = in.getAnnotation().create() && !org.jboss.seam.contexts.Lifecycle.isDestroying();
+         result = getInstanceInAllNamespaces(name, create);
       }
       else
       {
@@ -460,15 +462,25 @@
                );
          }
          
-         
          log.trace("trying to inject from specified context: " + name);
          
          if ( in.getAnnotation().scope().isContextActive() )
          {
-            return in.getAnnotation().scope().getContext().get(name);
+            result = in.getAnnotation().scope().getContext().get(name);
          }
+         else 
+         {
+            result = null;
+         }
       }
-      return null;
+      if ( result==null && in.getAnnotation().required() )
+      {
+         throw new RequiredException( "@In attribute requires non-null value: " + type + '.' + name );
+      }
+      else
+      {
+         return result;
+      }
    }
    
    private static Object getInstanceInAllNamespaces(String name, boolean create)




More information about the seam-commits mailing list