You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by th...@apache.org on 2020/12/05 21:06:33 UTC

[tapestry-5] branch java9modules updated: TAP5-2650: Change TypeCoercer configuration to be a mapped

This is an automated email from the ASF dual-hosted git repository.

thiagohp pushed a commit to branch java9modules
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git


The following commit(s) were added to refs/heads/java9modules by this push:
     new 5e86112  TAP5-2650: Change TypeCoercer configuration to be a mapped
5e86112 is described below

commit 5e86112f7600aabd8856b96847a14f98b1996671
Author: Thiago H. de Paula Figueiredo <th...@arsmachina.com.br>
AuthorDate: Sat Dec 5 18:06:13 2020 -0300

    TAP5-2650: Change TypeCoercer configuration to be a mapped
---
 .../main/java/org/apache/tapestry5/json/modules/JSONModule.java  | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tapestry-json/src/main/java/org/apache/tapestry5/json/modules/JSONModule.java b/tapestry-json/src/main/java/org/apache/tapestry5/json/modules/JSONModule.java
index cd11253..82b6154 100644
--- a/tapestry-json/src/main/java/org/apache/tapestry5/json/modules/JSONModule.java
+++ b/tapestry-json/src/main/java/org/apache/tapestry5/json/modules/JSONModule.java
@@ -15,6 +15,7 @@
 package org.apache.tapestry5.json.modules;
 
 import org.apache.tapestry5.commons.Configuration;
+import org.apache.tapestry5.commons.MappedConfiguration;
 import org.apache.tapestry5.commons.services.CoercionTuple;
 import org.apache.tapestry5.commons.services.TypeCoercer;
 import org.apache.tapestry5.internal.json.StringToJSONArray;
@@ -40,10 +41,12 @@ public class JSONModule
      * @param configuration the configuration to provide the type coercer to
      */
     @Contribute(TypeCoercer.class)
-    public static void provideCoercions(Configuration<CoercionTuple> configuration)
+    public static void provideCoercions(MappedConfiguration<CoercionTuple.Key, CoercionTuple> configuration)
     {
-        configuration.add(CoercionTuple.create(String.class, JSONObject.class, new StringToJSONObject()));
+        CoercionTuple<String, JSONObject> stringToJsonObject = CoercionTuple.create(String.class, JSONObject.class, new StringToJSONObject());
+        configuration.add(stringToJsonObject.getKey(), stringToJsonObject);
 
-        configuration.add(CoercionTuple.create(String.class, JSONArray.class, new StringToJSONArray()));
+        CoercionTuple<String, JSONArray> stringToJsonArray = CoercionTuple.create(String.class, JSONArray.class, new StringToJSONArray());
+        configuration.add(stringToJsonArray.getKey(), stringToJsonArray);
     }
 }