You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2011/09/23 20:28:51 UTC

svn commit: r1174941 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/corelib/pages/ main/java/org/apache/tapestry5/internal/services/ main/java/org/apache/tapestry5/services/ main/java/org/apache/tapestry5/util/ test/ja...

Author: hlship
Date: Fri Sep 23 18:28:50 2011
New Revision: 1174941

URL: http://svn.apache.org/viewvc?rev=1174941&view=rev
Log:
TAP5-1331: EnumValueEncoder should identify legal values when a non-matching string is passed to it for conversion

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyEditBlocks.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EnumValueEncoderFactory.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/util/EnumValueEncoder.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PaletteDemo.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectZoneDemo.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyEditBlocks.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyEditBlocks.java?rev=1174941&r1=1174940&r2=1174941&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyEditBlocks.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyEditBlocks.java Fri Sep 23 18:28:50 2011
@@ -1,4 +1,4 @@
-// Copyright 2007, 2008 The Apache Software Foundation
+// Copyright 2007, 2008, 2011 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -21,6 +21,8 @@ import org.apache.tapestry5.ValueEncoder
 import org.apache.tapestry5.annotations.Component;
 import org.apache.tapestry5.annotations.Environmental;
 import org.apache.tapestry5.corelib.components.*;
+import org.apache.tapestry5.ioc.annotations.Inject;
+import org.apache.tapestry5.ioc.services.TypeCoercer;
 import org.apache.tapestry5.services.BeanBlockContribution;
 import org.apache.tapestry5.services.BeanBlockSource;
 import org.apache.tapestry5.services.PropertyEditContext;
@@ -69,7 +71,7 @@ public class PropertyEditBlocks
             parameters = {"value=context.propertyValue", "label=prop:context.label", "clientId=prop:context.propertyid",
                     "validate=prop:dateFieldValidator"})
     private DateField dateField;
-    
+
     @SuppressWarnings("unused")
     @Component(
             parameters = {"value=context.propertyValue", "label=prop:context.label", "clientId=prop:context.propertyid",
@@ -90,6 +92,9 @@ public class PropertyEditBlocks
     private TextArea textArea;
 
 
+    @Inject
+    private TypeCoercer typeCoercer;
+
     public PropertyEditContext getContext()
     {
         return context;
@@ -158,7 +163,7 @@ public class PropertyEditBlocks
     @SuppressWarnings("unchecked")
     public ValueEncoder getValueEncoderForProperty()
     {
-        return new EnumValueEncoder(context.getPropertyType());
+        return new EnumValueEncoder(typeCoercer, context.getPropertyType());
     }
 
     /**

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EnumValueEncoderFactory.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EnumValueEncoderFactory.java?rev=1174941&r1=1174940&r2=1174941&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EnumValueEncoderFactory.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EnumValueEncoderFactory.java Fri Sep 23 18:28:50 2011
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2011 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
 package org.apache.tapestry5.internal.services;
 
 import org.apache.tapestry5.ValueEncoder;
+import org.apache.tapestry5.ioc.services.TypeCoercer;
 import org.apache.tapestry5.services.ValueEncoderFactory;
 import org.apache.tapestry5.util.EnumValueEncoder;
 
@@ -25,8 +26,15 @@ import org.apache.tapestry5.util.EnumVal
  */
 public class EnumValueEncoderFactory<E extends Enum<E>> implements ValueEncoderFactory<E>
 {
+    private final TypeCoercer typeCoercer;
+
+    public EnumValueEncoderFactory(TypeCoercer typeCoercer)
+    {
+        this.typeCoercer = typeCoercer;
+    }
+
     public ValueEncoder<E> create(Class<E> type)
     {
-        return new EnumValueEncoder<E>(type);
+        return new EnumValueEncoder<E>(typeCoercer, type);
     }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=1174941&r1=1174940&r2=1174941&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java Fri Sep 23 18:28:50 2011
@@ -2198,7 +2198,7 @@ public final class TapestryModule
     {
         configuration.addInstance(Object.class, TypeCoercedValueEncoderFactory.class);
         configuration.add(String.class, new StringValueEncoder());
-        configuration.add(Enum.class, new EnumValueEncoderFactory());
+        configuration.addInstance(Enum.class, EnumValueEncoderFactory.class);
     }
 
     /**

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/util/EnumValueEncoder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/util/EnumValueEncoder.java?rev=1174941&r1=1174940&r2=1174941&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/util/EnumValueEncoder.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/util/EnumValueEncoder.java Fri Sep 23 18:28:50 2011
@@ -1,4 +1,4 @@
-// Copyright 2007, 2008, 2010 The Apache Software Foundation
+// Copyright 2007, 2008, 2010, 2011 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
@@ -16,17 +16,22 @@ package org.apache.tapestry5.util;
 
 import org.apache.tapestry5.ValueEncoder;
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
+import org.apache.tapestry5.ioc.services.TypeCoercer;
 
 /**
  * A value encoder that can be used for arbitrary Enum types. The enum name is stored as the client side value.
  */
 public class EnumValueEncoder<E extends Enum<E>> implements ValueEncoder<E>
 {
+    private final TypeCoercer typeCoercer;
+
     private final Class<E> enumType;
 
-    public EnumValueEncoder(final Class<E> enumType)
+    public EnumValueEncoder(TypeCoercer typeCoercer, final Class<E> enumType)
     {
         assert enumType != null;
+
+        this.typeCoercer = typeCoercer;
         this.enumType = enumType;
     }
 
@@ -43,7 +48,7 @@ public class EnumValueEncoder<E extends 
         if (InternalUtils.isBlank(clientValue))
             return null;
 
-        return Enum.valueOf(enumType, clientValue);
+        return typeCoercer.coerce(clientValue, enumType);
     }
 
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PaletteDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PaletteDemo.java?rev=1174941&r1=1174940&r2=1174941&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PaletteDemo.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PaletteDemo.java Fri Sep 23 18:28:50 2011
@@ -20,6 +20,7 @@ import org.apache.tapestry5.ValueEncoder
 import org.apache.tapestry5.annotations.Persist;
 import org.apache.tapestry5.integration.app1.data.ProgrammingLanguage;
 import org.apache.tapestry5.ioc.annotations.Inject;
+import org.apache.tapestry5.ioc.services.TypeCoercer;
 import org.apache.tapestry5.util.EnumSelectModel;
 import org.apache.tapestry5.util.EnumValueEncoder;
 
@@ -36,6 +37,9 @@ public class PaletteDemo
     @Persist
     private boolean reorder;
 
+    @Inject
+    private TypeCoercer typeCoercer;
+
     public boolean isReorder()
     {
         return reorder;
@@ -64,7 +68,7 @@ public class PaletteDemo
     @SuppressWarnings("unchecked")
     public ValueEncoder getLanguageEncoder()
     {
-        return new EnumValueEncoder(ProgrammingLanguage.class);
+        return new EnumValueEncoder(typeCoercer, ProgrammingLanguage.class);
     }
 
     void onActionFromReset()

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectZoneDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectZoneDemo.java?rev=1174941&r1=1174940&r2=1174941&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectZoneDemo.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectZoneDemo.java Fri Sep 23 18:28:50 2011
@@ -13,9 +13,6 @@
 // limitations under the License.
 package org.apache.tapestry5.integration.app1.pages;
 
-import java.util.Arrays;
-import java.util.List;
-
 import org.apache.tapestry5.Block;
 import org.apache.tapestry5.SelectModel;
 import org.apache.tapestry5.ValueEncoder;
@@ -24,9 +21,13 @@ import org.apache.tapestry5.annotations.
 import org.apache.tapestry5.integration.app1.data.CarMaker;
 import org.apache.tapestry5.ioc.Messages;
 import org.apache.tapestry5.ioc.annotations.Inject;
+import org.apache.tapestry5.ioc.services.TypeCoercer;
 import org.apache.tapestry5.util.EnumSelectModel;
 import org.apache.tapestry5.util.EnumValueEncoder;
 
+import java.util.Arrays;
+import java.util.List;
+
 public class SelectZoneDemo
 {
 
@@ -49,6 +50,10 @@ public class SelectZoneDemo
     @Persist
     private List<String> availableModels;
 
+    @Inject
+    private TypeCoercer typeCoercer;
+
+
     public Object onValueChanged(final CarMaker maker)
     {
         availableModels = findAvailableModels(maker);
@@ -78,7 +83,7 @@ public class SelectZoneDemo
 
     public ValueEncoder<CarMaker> getMakeEncoder()
     {
-        return new EnumValueEncoder<CarMaker>(CarMaker.class);
+        return new EnumValueEncoder<CarMaker>(typeCoercer, CarMaker.class);
     }
 
 }



Re: svn commit: r1174941 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/corelib/pages/ main/java/org/apache/tapestry5/internal/services/ main/java/org/apache/tapestry5/services/ main/java/org/apache/tapestry5/util/ test/ja...

Posted by Ulrich Stärk <ul...@spielviel.de>.
I'm only experiencing this now, otherwise I would have spoken up earlier.

This is a backwards-incompatible change of a public API.

Although the fix is trivial it needs to be documented. We (Tapestry devs) probably didn't encounter
it earlier because we rely on EnumValueEncoderFactory internally, but that's internal API, while the
EnumValueEncoder itself isn't.

Uli

On 23.09.2011 20:28, hlship@apache.org wrote:
> Author: hlship
> Date: Fri Sep 23 18:28:50 2011
> New Revision: 1174941
>
> URL: http://svn.apache.org/viewvc?rev=1174941&view=rev
> Log:
> TAP5-1331: EnumValueEncoder should identify legal values when a non-matching string is passed to it for conversion
>
> Modified:
>     tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyEditBlocks.java
>     tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EnumValueEncoderFactory.java
>     tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
>     tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/util/EnumValueEncoder.java
>     tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PaletteDemo.java
>     tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectZoneDemo.java
>
> Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyEditBlocks.java
> URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyEditBlocks.java?rev=1174941&r1=1174940&r2=1174941&view=diff
> ==============================================================================
> --- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyEditBlocks.java (original)
> +++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/PropertyEditBlocks.java Fri Sep 23 18:28:50 2011
> @@ -1,4 +1,4 @@
> -// Copyright 2007, 2008 The Apache Software Foundation
> +// Copyright 2007, 2008, 2011 The Apache Software Foundation
>  //
>  // Licensed under the Apache License, Version 2.0 (the "License");
>  // you may not use this file except in compliance with the License.
> @@ -21,6 +21,8 @@ import org.apache.tapestry5.ValueEncoder
>  import org.apache.tapestry5.annotations.Component;
>  import org.apache.tapestry5.annotations.Environmental;
>  import org.apache.tapestry5.corelib.components.*;
> +import org.apache.tapestry5.ioc.annotations.Inject;
> +import org.apache.tapestry5.ioc.services.TypeCoercer;
>  import org.apache.tapestry5.services.BeanBlockContribution;
>  import org.apache.tapestry5.services.BeanBlockSource;
>  import org.apache.tapestry5.services.PropertyEditContext;
> @@ -69,7 +71,7 @@ public class PropertyEditBlocks
>              parameters = {"value=context.propertyValue", "label=prop:context.label", "clientId=prop:context.propertyid",
>                      "validate=prop:dateFieldValidator"})
>      private DateField dateField;
> -    
> +
>      @SuppressWarnings("unused")
>      @Component(
>              parameters = {"value=context.propertyValue", "label=prop:context.label", "clientId=prop:context.propertyid",
> @@ -90,6 +92,9 @@ public class PropertyEditBlocks
>      private TextArea textArea;
>  
>  
> +    @Inject
> +    private TypeCoercer typeCoercer;
> +
>      public PropertyEditContext getContext()
>      {
>          return context;
> @@ -158,7 +163,7 @@ public class PropertyEditBlocks
>      @SuppressWarnings("unchecked")
>      public ValueEncoder getValueEncoderForProperty()
>      {
> -        return new EnumValueEncoder(context.getPropertyType());
> +        return new EnumValueEncoder(typeCoercer, context.getPropertyType());
>      }
>  
>      /**
>
> Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EnumValueEncoderFactory.java
> URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EnumValueEncoderFactory.java?rev=1174941&r1=1174940&r2=1174941&view=diff
> ==============================================================================
> --- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EnumValueEncoderFactory.java (original)
> +++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EnumValueEncoderFactory.java Fri Sep 23 18:28:50 2011
> @@ -1,4 +1,4 @@
> -// Copyright 2007 The Apache Software Foundation
> +// Copyright 2007, 2011 The Apache Software Foundation
>  //
>  // Licensed under the Apache License, Version 2.0 (the "License");
>  // you may not use this file except in compliance with the License.
> @@ -15,6 +15,7 @@
>  package org.apache.tapestry5.internal.services;
>  
>  import org.apache.tapestry5.ValueEncoder;
> +import org.apache.tapestry5.ioc.services.TypeCoercer;
>  import org.apache.tapestry5.services.ValueEncoderFactory;
>  import org.apache.tapestry5.util.EnumValueEncoder;
>  
> @@ -25,8 +26,15 @@ import org.apache.tapestry5.util.EnumVal
>   */
>  public class EnumValueEncoderFactory<E extends Enum<E>> implements ValueEncoderFactory<E>
>  {
> +    private final TypeCoercer typeCoercer;
> +
> +    public EnumValueEncoderFactory(TypeCoercer typeCoercer)
> +    {
> +        this.typeCoercer = typeCoercer;
> +    }
> +
>      public ValueEncoder<E> create(Class<E> type)
>      {
> -        return new EnumValueEncoder<E>(type);
> +        return new EnumValueEncoder<E>(typeCoercer, type);
>      }
>  }
>
> Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
> URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=1174941&r1=1174940&r2=1174941&view=diff
> ==============================================================================
> --- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java (original)
> +++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java Fri Sep 23 18:28:50 2011
> @@ -2198,7 +2198,7 @@ public final class TapestryModule
>      {
>          configuration.addInstance(Object.class, TypeCoercedValueEncoderFactory.class);
>          configuration.add(String.class, new StringValueEncoder());
> -        configuration.add(Enum.class, new EnumValueEncoderFactory());
> +        configuration.addInstance(Enum.class, EnumValueEncoderFactory.class);
>      }
>  
>      /**
>
> Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/util/EnumValueEncoder.java
> URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/util/EnumValueEncoder.java?rev=1174941&r1=1174940&r2=1174941&view=diff
> ==============================================================================
> --- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/util/EnumValueEncoder.java (original)
> +++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/util/EnumValueEncoder.java Fri Sep 23 18:28:50 2011
> @@ -1,4 +1,4 @@
> -// Copyright 2007, 2008, 2010 The Apache Software Foundation
> +// Copyright 2007, 2008, 2010, 2011 The Apache Software Foundation
>  //
>  // Licensed under the Apache License, Version 2.0 (the "License");
>  // you may not use this file except in compliance with the License.
> @@ -16,17 +16,22 @@ package org.apache.tapestry5.util;
>  
>  import org.apache.tapestry5.ValueEncoder;
>  import org.apache.tapestry5.ioc.internal.util.InternalUtils;
> +import org.apache.tapestry5.ioc.services.TypeCoercer;
>  
>  /**
>   * A value encoder that can be used for arbitrary Enum types. The enum name is stored as the client side value.
>   */
>  public class EnumValueEncoder<E extends Enum<E>> implements ValueEncoder<E>
>  {
> +    private final TypeCoercer typeCoercer;
> +
>      private final Class<E> enumType;
>  
> -    public EnumValueEncoder(final Class<E> enumType)
> +    public EnumValueEncoder(TypeCoercer typeCoercer, final Class<E> enumType)
>      {
>          assert enumType != null;
> +
> +        this.typeCoercer = typeCoercer;
>          this.enumType = enumType;
>      }
>  
> @@ -43,7 +48,7 @@ public class EnumValueEncoder<E extends 
>          if (InternalUtils.isBlank(clientValue))
>              return null;
>  
> -        return Enum.valueOf(enumType, clientValue);
> +        return typeCoercer.coerce(clientValue, enumType);
>      }
>  
>  }
>
> Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PaletteDemo.java
> URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PaletteDemo.java?rev=1174941&r1=1174940&r2=1174941&view=diff
> ==============================================================================
> --- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PaletteDemo.java (original)
> +++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/PaletteDemo.java Fri Sep 23 18:28:50 2011
> @@ -20,6 +20,7 @@ import org.apache.tapestry5.ValueEncoder
>  import org.apache.tapestry5.annotations.Persist;
>  import org.apache.tapestry5.integration.app1.data.ProgrammingLanguage;
>  import org.apache.tapestry5.ioc.annotations.Inject;
> +import org.apache.tapestry5.ioc.services.TypeCoercer;
>  import org.apache.tapestry5.util.EnumSelectModel;
>  import org.apache.tapestry5.util.EnumValueEncoder;
>  
> @@ -36,6 +37,9 @@ public class PaletteDemo
>      @Persist
>      private boolean reorder;
>  
> +    @Inject
> +    private TypeCoercer typeCoercer;
> +
>      public boolean isReorder()
>      {
>          return reorder;
> @@ -64,7 +68,7 @@ public class PaletteDemo
>      @SuppressWarnings("unchecked")
>      public ValueEncoder getLanguageEncoder()
>      {
> -        return new EnumValueEncoder(ProgrammingLanguage.class);
> +        return new EnumValueEncoder(typeCoercer, ProgrammingLanguage.class);
>      }
>  
>      void onActionFromReset()
>
> Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectZoneDemo.java
> URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectZoneDemo.java?rev=1174941&r1=1174940&r2=1174941&view=diff
> ==============================================================================
> --- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectZoneDemo.java (original)
> +++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/SelectZoneDemo.java Fri Sep 23 18:28:50 2011
> @@ -13,9 +13,6 @@
>  // limitations under the License.
>  package org.apache.tapestry5.integration.app1.pages;
>  
> -import java.util.Arrays;
> -import java.util.List;
> -
>  import org.apache.tapestry5.Block;
>  import org.apache.tapestry5.SelectModel;
>  import org.apache.tapestry5.ValueEncoder;
> @@ -24,9 +21,13 @@ import org.apache.tapestry5.annotations.
>  import org.apache.tapestry5.integration.app1.data.CarMaker;
>  import org.apache.tapestry5.ioc.Messages;
>  import org.apache.tapestry5.ioc.annotations.Inject;
> +import org.apache.tapestry5.ioc.services.TypeCoercer;
>  import org.apache.tapestry5.util.EnumSelectModel;
>  import org.apache.tapestry5.util.EnumValueEncoder;
>  
> +import java.util.Arrays;
> +import java.util.List;
> +
>  public class SelectZoneDemo
>  {
>  
> @@ -49,6 +50,10 @@ public class SelectZoneDemo
>      @Persist
>      private List<String> availableModels;
>  
> +    @Inject
> +    private TypeCoercer typeCoercer;
> +
> +
>      public Object onValueChanged(final CarMaker maker)
>      {
>          availableModels = findAvailableModels(maker);
> @@ -78,7 +83,7 @@ public class SelectZoneDemo
>  
>      public ValueEncoder<CarMaker> getMakeEncoder()
>      {
> -        return new EnumValueEncoder<CarMaker>(CarMaker.class);
> +        return new EnumValueEncoder<CarMaker>(typeCoercer, CarMaker.class);
>      }
>  
>  }
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org