Move JSONModule into a modules package
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/ef175ac2 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/ef175ac2 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/ef175ac2 Branch: refs/heads/master Commit: ef175ac2b9a21f2ddca78eedaeba9aad91c562a2 Parents: bf41b2b Author: Howard M. Lewis Ship <[email protected]> Authored: Mon Apr 22 17:18:54 2013 -0700 Committer: Howard M. Lewis Ship <[email protected]> Committed: Mon Apr 22 17:18:54 2013 -0700 ---------------------------------------------------------------------- tapestry-json/build.gradle | 2 +- .../apache/tapestry5/json/modules/JSONModule.java | 48 +++++++++++++++ .../tapestry5/json/modules/package-info.java | 19 ++++++ .../apache/tapestry5/json/services/JSONModule.java | 48 --------------- .../tapestry5/json/services/package-info.java | 18 ------ 5 files changed, 68 insertions(+), 67 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ef175ac2/tapestry-json/build.gradle ---------------------------------------------------------------------- diff --git a/tapestry-json/build.gradle b/tapestry-json/build.gradle index bf3eb8a..a94d169 100644 --- a/tapestry-json/build.gradle +++ b/tapestry-json/build.gradle @@ -12,6 +12,6 @@ test { jar { manifest { - attributes 'Tapestry-Module-Classes': 'org.apache.tapestry5.json.services.JSONModule' + attributes 'Tapestry-Module-Classes': 'org.apache.tapestry5.json.modules.JSONModule' } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ef175ac2/tapestry-json/src/main/java/org/apache/tapestry5/json/modules/JSONModule.java ---------------------------------------------------------------------- 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 new file mode 100644 index 0000000..6afe25b --- /dev/null +++ b/tapestry-json/src/main/java/org/apache/tapestry5/json/modules/JSONModule.java @@ -0,0 +1,48 @@ +// Copyright 2011-2013 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. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.apache.tapestry5.json.modules; + +import org.apache.tapestry5.internal.json.StringToJSONArray; +import org.apache.tapestry5.internal.json.StringToJSONObject; +import org.apache.tapestry5.ioc.Configuration; +import org.apache.tapestry5.ioc.annotations.Contribute; +import org.apache.tapestry5.ioc.services.CoercionTuple; +import org.apache.tapestry5.ioc.services.TypeCoercer; +import org.apache.tapestry5.json.JSONArray; +import org.apache.tapestry5.json.JSONObject; + +/** + * A module that integrates JSON into Tapestry in terms of type coercions. tapestry-json can still + * be used independently of the rest of Tapestry (since its a 'provided' dependency), + * but when used with tapestry-ioc on the classpath, the coercions described by this module become available. + * + * @since 5.3 + */ +public class JSONModule +{ + /** + * <ul> + * <li>{@link String} to {@link org.apache.tapestry5.json.JSONObject}</li> + * <li>{@link String} to {@link org.apache.tapestry5.json.JSONArray}</li> + * </ul> + */ + @Contribute(TypeCoercer.class) + public static void provideCoercions(Configuration<CoercionTuple> configuration) + { + configuration.add(CoercionTuple.create(String.class, JSONObject.class, new StringToJSONObject())); + + configuration.add(CoercionTuple.create(String.class, JSONArray.class, new StringToJSONArray())); + } +} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ef175ac2/tapestry-json/src/main/java/org/apache/tapestry5/json/modules/package-info.java ---------------------------------------------------------------------- diff --git a/tapestry-json/src/main/java/org/apache/tapestry5/json/modules/package-info.java b/tapestry-json/src/main/java/org/apache/tapestry5/json/modules/package-info.java new file mode 100644 index 0000000..1f01fb1 --- /dev/null +++ b/tapestry-json/src/main/java/org/apache/tapestry5/json/modules/package-info.java @@ -0,0 +1,19 @@ +// Copyright 2012-2013 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. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * Optional module that allows JSON objects to be used with the {@link org.apache.tapestry5.ioc.services.TypeCoercer} service, when + * the tapestry-ioc module is present. + */ +package org.apache.tapestry5.json.modules; http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ef175ac2/tapestry-json/src/main/java/org/apache/tapestry5/json/services/JSONModule.java ---------------------------------------------------------------------- diff --git a/tapestry-json/src/main/java/org/apache/tapestry5/json/services/JSONModule.java b/tapestry-json/src/main/java/org/apache/tapestry5/json/services/JSONModule.java deleted file mode 100644 index 2ddf2ab..0000000 --- a/tapestry-json/src/main/java/org/apache/tapestry5/json/services/JSONModule.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 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. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package org.apache.tapestry5.json.services; - -import org.apache.tapestry5.internal.json.StringToJSONArray; -import org.apache.tapestry5.internal.json.StringToJSONObject; -import org.apache.tapestry5.ioc.Configuration; -import org.apache.tapestry5.ioc.annotations.Contribute; -import org.apache.tapestry5.ioc.services.CoercionTuple; -import org.apache.tapestry5.ioc.services.TypeCoercer; -import org.apache.tapestry5.json.JSONArray; -import org.apache.tapestry5.json.JSONObject; - -/** - * A module that integrates JSON into Tapestry in terms of type coercions. tapestry-json can still - * be used independently of the rest of Tapestry (since its a 'provided' dependency), - * but when used with tapestry-ioc on the classpath, the coercions described by this module become available. - * - * @since 5.3 - */ -public class JSONModule -{ - /** - * <ul> - * <li>{@link String} to {@link org.apache.tapestry5.json.JSONObject}</li> - * <li>{@link String} to {@link org.apache.tapestry5.json.JSONArray}</li> - * </ul> - */ - @Contribute(TypeCoercer.class) - public static void provideCoercions(Configuration<CoercionTuple> configuration) - { - configuration.add(CoercionTuple.create(String.class, JSONObject.class, new StringToJSONObject())); - - configuration.add(CoercionTuple.create(String.class, JSONArray.class, new StringToJSONArray())); - } -} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ef175ac2/tapestry-json/src/main/java/org/apache/tapestry5/json/services/package-info.java ---------------------------------------------------------------------- diff --git a/tapestry-json/src/main/java/org/apache/tapestry5/json/services/package-info.java b/tapestry-json/src/main/java/org/apache/tapestry5/json/services/package-info.java deleted file mode 100644 index ae555aa..0000000 --- a/tapestry-json/src/main/java/org/apache/tapestry5/json/services/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 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. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/** - * JSON services - */ -package org.apache.tapestry5.json.services;
