diff --git a/src/Famix-Value-Importer/Collection.extension.st b/src/Famix-Value-Importer/Collection.extension.st index e071bd0..35f585a 100644 --- a/src/Famix-Value-Importer/Collection.extension.st +++ b/src/Famix-Value-Importer/Collection.extension.st @@ -27,7 +27,7 @@ Collection >> asJavaJacksonValueOn: importer [ Collection >> asPharoJacksonValueOn: importer [ ^ importer - importCollection: self + importArray: self of: (importer loadTypeNamed: self className) ] diff --git a/src/Famix-Value-Importer/FamixValuePharoJacksonImporter.class.st b/src/Famix-Value-Importer/FamixValuePharoJacksonImporter.class.st index 8b92ebd..df709a9 100644 --- a/src/Famix-Value-Importer/FamixValuePharoJacksonImporter.class.st +++ b/src/Famix-Value-Importer/FamixValuePharoJacksonImporter.class.st @@ -36,6 +36,15 @@ FamixValuePharoJacksonImporter >> idKey: aString [ idKey := aString ] +{ #category : #importing } +FamixValuePharoJacksonImporter >> importArray: rawValue of: type [ + + ^ objectDict + at: rawValue first + ifAbsentPut: [ + super importCollection: rawValue allButFirst of: type ] +] + { #category : #importing } FamixValuePharoJacksonImporter >> importAssociation: rawValue of: type [ @@ -75,23 +84,23 @@ FamixValuePharoJacksonImporter >> importClosure: value of: type [ { #category : #importing } FamixValuePharoJacksonImporter >> importCollection: rawValue of: type [ - ^ objectDict - at: rawValue first - ifAbsentPut: [ - super importCollection: rawValue allButFirst of: type ] + | collection | + collection := self model newOfCollection type: type. + objectDict at: (self getObjectIdentity: rawValue) put: collection. + (rawValue at: '@') do: [ :rawElement | + collection addValue: (self model newOfCollectionElement value: + (self importValue: rawElement)) ]. + ^ collection ] { #category : #importing } FamixValuePharoJacksonImporter >> importDictionary: rawValue of: type [ - | dictionary assoc | + | dictionary | dictionary := self model newOfDictionary type: type. objectDict at: (self getObjectIdentity: rawValue) put: dictionary. - rawValue associationsDo: [ :rawAssoc | - assoc := self model newOfDictionaryAssociation dictionary: - dictionary. - assoc key: (self importValue: rawAssoc key). - assoc value: (self importValue: rawAssoc value) ]. + (rawValue at: '@') do: [ :rawAssoc | + (rawAssoc asPharoJacksonValueOn: self) dictionary: dictionary ]. ^ dictionary ] @@ -159,12 +168,10 @@ FamixValuePharoJacksonImporter >> specialTypes [ put: [ :value :type | self importAssociation: value of: type ]. specialTypes at: 'OrderedCollection' - put: [ :value :type | - self importCollection: (value at: 'array') of: type ]. + put: [ :value :type | self importCollection: value of: type ]. specialTypes at: 'Set' - put: [ :value :type | - self importCollection: (value at: 'array') of: type ]. + put: [ :value :type | self importCollection: value of: type ]. specialTypes at: 'FullBlockClosure' put: [ :value :type | self importClosure: value of: type ]. @@ -174,6 +181,12 @@ FamixValuePharoJacksonImporter >> specialTypes [ specialTypes at: 'WideSymbol' put: [ :value :type | self importSymbol: value of: type ]. + specialTypes + at: 'Dictionary' + put: [ :value :type | self importDictionary: value of: type ]. + specialTypes + at: 'OrderedDictionary' + put: [ :value :type | self importDictionary: value of: type ]. specialTypes ] ]