[jboss-cvs] jboss-seam/src/main/org/jboss/seam/core ...

Gavin King gavin.king at jboss.com
Wed Feb 7 17:36:58 EST 2007


  User: gavin   
  Date: 07/02/07 17:36:58

  Modified:    src/main/org/jboss/seam/core  Init.java
  Log:
  JBSEAM- dupe factory
  
  Revision  Changes    Path
  1.36      +13 -2     jboss-seam/src/main/org/jboss/seam/core/Init.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Init.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/core/Init.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -b -r1.35 -r1.36
  --- Init.java	4 Feb 2007 07:57:17 -0000	1.35
  +++ Init.java	7 Feb 2007 22:36:58 -0000	1.36
  @@ -1,4 +1,4 @@
  -//$Id: Init.java,v 1.35 2007/02/04 07:57:17 gavin Exp $
  +//$Id: Init.java,v 1.36 2007/02/07 22:36:58 gavin Exp $
   package org.jboss.seam.core;
   
   
  @@ -171,18 +171,29 @@
         return factoryValueBindings.get(variable);
      }
      
  +   private void checkDuplicateFactory(String variable)
  +   {
  +      if ( factories.containsKey(variable) || factoryMethodBindings.containsKey(variable) || factoryValueBindings.containsKey(variable) )
  +      {
  +         throw new IllegalStateException("duplicate factory for: " + variable);
  +      }
  +   }
  +   
      public void addFactoryMethod(String variable, Method method, Component component)
      {
  +      checkDuplicateFactory(variable);
   	   factories.put( variable, new FactoryMethod(method, component) );
      }
      
      public void addFactoryMethodBinding(String variable, String methodBindingExpression, ScopeType scope)
      {
  +      checkDuplicateFactory(variable);
         factoryMethodBindings.put( variable, new FactoryBinding(methodBindingExpression, scope) );
      }
      
      public void addFactoryValueBinding(String variable, String valueBindingExpression, ScopeType scope)
      {
  +      checkDuplicateFactory(variable);
         factoryValueBindings.put( variable, new FactoryBinding(valueBindingExpression, scope) );
      }
      
  
  
  



More information about the jboss-cvs-commits mailing list