diff --git a/src/Famix-Value-Importer/Dictionary.extension.st b/src/Famix-Value-Importer/Dictionary.extension.st index 4cc7dcd..8fa2fcd 100644 --- a/src/Famix-Value-Importer/Dictionary.extension.st +++ b/src/Famix-Value-Importer/Dictionary.extension.st @@ -3,7 +3,7 @@ Extension { #name : #Dictionary } { #category : #'*Famix-Value-Importer' } Dictionary >> asPharoJacksonValueOn: importer [ - ^ (self removeKey: importer typeKey ifAbsent: nil) + ^ (importer getObjectType: self) ifNotNil: [ :className | "object of an unloaded class" className = 'Class' ifTrue: [ @@ -15,7 +15,7 @@ Dictionary >> asPharoJacksonValueOn: importer [ importObject: self of: (importer loadTypeNamed: className) ] ] ifNil: [ "species of dictionary" - (self removeKey: importer refKey ifAbsent: nil) + (importer getObjectReference: self) ifNotNil: [ :refId | "if @ref" importer getObjectFromIdentity: refId diff --git a/src/Famix-Value-Importer/FamixValueJavaJacksonImporter.class.st b/src/Famix-Value-Importer/FamixValueJavaJacksonImporter.class.st index fe94f57..8badc65 100644 --- a/src/Famix-Value-Importer/FamixValueJavaJacksonImporter.class.st +++ b/src/Famix-Value-Importer/FamixValueJavaJacksonImporter.class.st @@ -36,6 +36,12 @@ FamixValueJavaJacksonImporter >> getObjectIdentity: rawObject [ ^ rawObject removeKey: self idKey ifAbsent: nil ] +{ #category : #enumerating } +FamixValueJavaJacksonImporter >> getObjectType: rawObject [ + + ^ rawObject removeKey: self typeKey ifAbsent: nil +] + { #category : #accessing } FamixValueJavaJacksonImporter >> idKey [ @@ -62,6 +68,10 @@ FamixValueJavaJacksonImporter >> importClassReference: rawValue of: type [ FamixValueJavaJacksonImporter >> importObjectAttribute: rawValue of: type named: name [ | attribute | + type isInterface ifTrue: [ + Error signal: + 'Cannot find attributes in interfaces. Signaled for attribute `' + , name , '` and interface `' , type name , '`.' ]. (attribute := type findAttributeNamed: name) ifNotNil: [ "Skip transient attributes." attribute isTransient ifTrue: [ ^ nil ] ]. ^ self diff --git a/src/Famix-Value-Importer/FamixValuePharoJacksonImporter.class.st b/src/Famix-Value-Importer/FamixValuePharoJacksonImporter.class.st index df709a9..d4ae209 100644 --- a/src/Famix-Value-Importer/FamixValuePharoJacksonImporter.class.st +++ b/src/Famix-Value-Importer/FamixValuePharoJacksonImporter.class.st @@ -24,6 +24,18 @@ FamixValuePharoJacksonImporter >> getObjectIdentity: rawObject [ ^ rawObject removeKey: self idKey ifAbsent: nil ] +{ #category : #enumerating } +FamixValuePharoJacksonImporter >> getObjectReference: rawObject [ + + ^ rawObject removeKey: self refKey ifAbsent: nil +] + +{ #category : #enumerating } +FamixValuePharoJacksonImporter >> getObjectType: rawObject [ + + ^ rawObject removeKey: self typeKey ifAbsent: nil +] + { #category : #accessing } FamixValuePharoJacksonImporter >> idKey [ diff --git a/src/Famix-Value-Importer/OrderedDictionary.extension.st b/src/Famix-Value-Importer/OrderedDictionary.extension.st index 13296d1..3093c87 100644 --- a/src/Famix-Value-Importer/OrderedDictionary.extension.st +++ b/src/Famix-Value-Importer/OrderedDictionary.extension.st @@ -4,11 +4,11 @@ Extension { #name : #OrderedDictionary } OrderedDictionary >> asJavaJacksonValueOn: importer [ | type | - (self removeKey: importer typeKey ifAbsent: nil) - ifNotNil: [ :typeName | type := importer loadTypeNamed: typeName ] - ifNil: [ - (type := importer typeInference) ifNil: [ - self error: 'Cannot determine type.' ] ]. + type := (importer getObjectType: self) + ifNotNil: [ :typeName | importer loadTypeNamed: typeName ] + ifNil: [ + importer typeInference ifNil: [ + Error signal: 'Cannot determine type.' ] ]. ^ (type isUnknownType or: [ type isDictionaryType ]) ifTrue: [ importer importDictionary: self of: type ] ifFalse: [ importer importObject: self of: type ] @@ -17,7 +17,7 @@ OrderedDictionary >> asJavaJacksonValueOn: importer [ { #category : #'*Famix-Value-Importer' } OrderedDictionary >> asPharoJacksonValueOn: importer [ - ^ (self removeKey: importer typeKey ifAbsent: nil) + ^ (importer getObjectType: self) ifNotNil: [ :className | "object of an unloaded class" className = 'Class' ifTrue: [ @@ -29,7 +29,7 @@ OrderedDictionary >> asPharoJacksonValueOn: importer [ importObject: self of: (importer loadTypeNamed: className) ] ] ifNil: [ "species of dictionary" - (self removeKey: importer refKey ifAbsent: nil) + (importer getObjectReference: self) ifNotNil: [ :refId | "if @ref" importer getObjectFromIdentity: refId