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

Gavin King gavin.king at jboss.com
Sun Jan 28 16:42:34 EST 2007


  User: gavin   
  Date: 07/01/28 16:42:34

  Modified:    src/main/org/jboss/seam/util   Conversions.java
                        Reflections.java
  Log:
  JBSEAM-707 make EL work in <key> and <value> of Map
  
  Revision  Changes    Path
  1.12      +16 -0     jboss-seam/src/main/org/jboss/seam/util/Conversions.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Conversions.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/util/Conversions.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -b -r1.11 -r1.12
  --- Conversions.java	28 Jan 2007 19:12:05 -0000	1.11
  +++ Conversions.java	28 Jan 2007 21:42:34 -0000	1.12
  @@ -261,6 +261,7 @@
         String getSingleValue();
         boolean isExpression();
         boolean isMultiValued();
  +      boolean isAssociativeValued();
      }
      
      public static class FlatPropertyValue implements PropertyValue
  @@ -294,6 +295,11 @@
            return false;
         }
         
  +      public boolean isAssociativeValued()
  +      {
  +         return false;
  +      }
  +      
         public Map<String, String> getKeyedValues()
         {
            throw new UnsupportedOperationException("not a keyed property value");
  @@ -337,6 +343,11 @@
            return true;
         }
         
  +      public boolean isAssociativeValued()
  +      {
  +         return false;
  +      }
  +      
         public boolean isExpression()
         {
            return false;
  @@ -385,6 +396,11 @@
            return false;
         }
         
  +      public boolean isAssociativeValued()
  +      {
  +         return true;
  +      }
  +      
         @Override
         public String toString()
         {
  
  
  
  1.17      +20 -1     jboss-seam/src/main/org/jboss/seam/util/Reflections.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Reflections.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/util/Reflections.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -b -r1.16 -r1.17
  --- Reflections.java	26 Nov 2006 02:55:13 -0000	1.16
  +++ Reflections.java	28 Jan 2007 21:42:34 -0000	1.17
  @@ -1,4 +1,4 @@
  -//$Id: Reflections.java,v 1.16 2006/11/26 02:55:13 gavin Exp $
  +//$Id: Reflections.java,v 1.17 2007/01/28 21:42:34 gavin Exp $
   package org.jboss.seam.util;
   
   import java.beans.Introspector;
  @@ -162,6 +162,25 @@
         return (Class) typeArgument;
      }
      
  +   public static Class getMapKeyType(Type collectionType)
  +   {
  +      if ( !(collectionType instanceof ParameterizedType) )
  +      {
  +         throw new IllegalArgumentException("collection type not parameterized");
  +      }
  +      Type[] typeArguments = ( (ParameterizedType) collectionType ).getActualTypeArguments();
  +      if (typeArguments.length==0)
  +      {
  +         throw new IllegalArgumentException("no type arguments for collection type");
  +      }
  +      Type typeArgument = typeArguments[0];
  +      if ( !(typeArgument instanceof Class) )
  +      {
  +         throw new IllegalArgumentException("type argument not a class");
  +      }
  +      return (Class) typeArgument;
  +   }
  +   
      public static Method getSetterMethod(Class clazz, String name)
      {
         Method[] methods = clazz.getMethods();
  
  
  



More information about the jboss-cvs-commits mailing list