From a821f71afe82bedbd574fab218f3088a996447ee Mon Sep 17 00:00:00 2001 From: Juraj Kubelka Date: Sun, 14 Jul 2024 18:28:53 -0400 Subject: [PATCH] deprecate `#asJson` [feenkcom/gtoolkit#3895] --- src/GToolkit4Json/Dictionary.extension.st | 11 ++++++++++- src/GToolkit4Json/GtJsonBasic.class.st | 11 ++++++++++- src/GToolkit4Json/GtJsonModelExamples.class.st | 3 +-- src/GToolkit4Json/OrderedDictionary.extension.st | 11 ++++++++++- src/GToolkit4Json/SequenceableCollection.extension.st | 11 ++++++++++- src/GToolkit4Json/ZnMessage.extension.st | 11 ++++++++++- 6 files changed, 51 insertions(+), 7 deletions(-) diff --git a/src/GToolkit4Json/Dictionary.extension.st b/src/GToolkit4Json/Dictionary.extension.st index c615fd5..7b5a8ac 100644 --- a/src/GToolkit4Json/Dictionary.extension.st +++ b/src/GToolkit4Json/Dictionary.extension.st @@ -1,11 +1,20 @@ Extension { #name : #Dictionary } { #category : #'*GToolkit4Json' } -Dictionary >> asJson [ +Dictionary >> asGtJson [ ^ GtJson forJsonObject: self ] +{ #category : #'*GToolkit4Json' } +Dictionary >> asJson [ + self + deprecated: 'Please use #asGtJson instead.' + transformWith: '`@receiver asJson' -> '`@receiver asGtJson'. + + ^ self asGtJson +] + { #category : #'*GToolkit4Json' } Dictionary >> gtJsonValueDisplayText [ ^ self size gtDisplayText diff --git a/src/GToolkit4Json/GtJsonBasic.class.st b/src/GToolkit4Json/GtJsonBasic.class.st index 60d1ee7..caf3880 100644 --- a/src/GToolkit4Json/GtJsonBasic.class.st +++ b/src/GToolkit4Json/GtJsonBasic.class.st @@ -38,11 +38,20 @@ GtJsonBasic >> allValuesDepthFirstDo: aBlock [ ] { #category : #converting } -GtJsonBasic >> asJson [ +GtJsonBasic >> asGtJson [ ^ self ] +{ #category : #converting } +GtJsonBasic >> asJson [ + self + deprecated: 'Please use #asGtJson instead.' + transformWith: '`@receiver asJson' -> '`@receiver asGtJson'. + + ^ self asGtJson +] + { #category : #converting } GtJsonBasic >> asJsonString [ diff --git a/src/GToolkit4Json/GtJsonModelExamples.class.st b/src/GToolkit4Json/GtJsonModelExamples.class.st index 581c328..64a0343 100644 --- a/src/GToolkit4Json/GtJsonModelExamples.class.st +++ b/src/GToolkit4Json/GtJsonModelExamples.class.st @@ -324,9 +324,8 @@ GtJsonModelExamples >> primaryAddressModel_JsonValues [ { #category : #'examples - person' } GtJsonModelExamples >> simplePersonJson [ - - ^ GtJsonExamples new simplePersonJsonObject asJson. + ^ GtJsonExamples new simplePersonJsonObject asGtJson ] { #category : #'examples - simple person' } diff --git a/src/GToolkit4Json/OrderedDictionary.extension.st b/src/GToolkit4Json/OrderedDictionary.extension.st index 78e485e..40640fb 100644 --- a/src/GToolkit4Json/OrderedDictionary.extension.st +++ b/src/GToolkit4Json/OrderedDictionary.extension.st @@ -1,11 +1,20 @@ Extension { #name : #OrderedDictionary } { #category : #'*GToolkit4Json' } -OrderedDictionary >> asJson [ +OrderedDictionary >> asGtJson [ ^ GtJson forJsonObject: self ] +{ #category : #'*GToolkit4Json' } +OrderedDictionary >> asJson [ + self + deprecated: 'Please use #asGtJson instead.' + transformWith: '`@receiver asJson' -> '`@receiver asGtJson'. + + ^ self asGtJson +] + { #category : #'*GToolkit4Json' } OrderedDictionary >> gtJsonValueDisplayText [ ^ self size gtDisplayText diff --git a/src/GToolkit4Json/SequenceableCollection.extension.st b/src/GToolkit4Json/SequenceableCollection.extension.st index a3754c0..e3b02a5 100644 --- a/src/GToolkit4Json/SequenceableCollection.extension.st +++ b/src/GToolkit4Json/SequenceableCollection.extension.st @@ -1,7 +1,16 @@ Extension { #name : #SequenceableCollection } { #category : #'*GToolkit4Json' } -SequenceableCollection >> asJson [ +SequenceableCollection >> asGtJson [ ^ GtJson forJsonObject: self ] + +{ #category : #'*GToolkit4Json' } +SequenceableCollection >> asJson [ + self + deprecated: 'Please use #asGtJson instead.' + transformWith: '`@receiver asJson' -> '`@receiver asGtJson'. + + ^ self asGtJson +] diff --git a/src/GToolkit4Json/ZnMessage.extension.st b/src/GToolkit4Json/ZnMessage.extension.st index 8c9fe84..26b9d7d 100644 --- a/src/GToolkit4Json/ZnMessage.extension.st +++ b/src/GToolkit4Json/ZnMessage.extension.st @@ -1,6 +1,15 @@ Extension { #name : #ZnMessage } { #category : #'*GToolkit4Json' } -ZnMessage >> asJson [ +ZnMessage >> asGtJson [ ^ GtJson forJsonString: self contents ] + +{ #category : #'*GToolkit4Json' } +ZnMessage >> asJson [ + self + deprecated: 'Please use #asGtJson instead.' + transformWith: '`@receiver asJson' -> '`@receiver asGtJson'. + + ^ self asGtJson +]