Skip to content

Commit

Permalink
Merge b497c8c
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel-Darbord committed Jul 2, 2024
2 parents 93a3159 + b497c8c commit 80483cb
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Famix-Value-Importer/Dictionary.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand All @@ -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
Expand Down
10 changes: 10 additions & 0 deletions src/Famix-Value-Importer/FamixValueJavaJacksonImporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 [

Expand All @@ -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
Expand Down
12 changes: 12 additions & 0 deletions src/Famix-Value-Importer/FamixValuePharoJacksonImporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 [

Expand Down
14 changes: 7 additions & 7 deletions src/Famix-Value-Importer/OrderedDictionary.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
Expand All @@ -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: [
Expand All @@ -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
Expand Down

0 comments on commit 80483cb

Please sign in to comment.