diff --git a/src/Famix-Value-Entities/FamixValueOfType.class.st b/src/Famix-Value-Entities/FamixValueOfType.class.st index a1aea66..b5c8540 100644 --- a/src/Famix-Value-Entities/FamixValueOfType.class.st +++ b/src/Famix-Value-Entities/FamixValueOfType.class.st @@ -70,27 +70,6 @@ FamixValueOfType >> addValueInDictionary: anObject [ ^ self valueInDictionaries add: anObject ] -{ #category : #'ston persistence' } -FamixValueOfType >> asJsonString [ - "Currently does not work. Ideas: - - Find a way to serialize any object while handling circular dependencies. - - Use the json stored in the root value to read it into raw objects and traverse the path to this value." - - self flag: #TODO. - ^ self asNeoJSONObject asString -] - -{ #category : #'ston persistence' } -FamixValueOfType >> asNeoJSONObject [ - - self flag: #TODO. "see #asJsonString" - ^ self typedEntity - ifNotNil: [ "at root" - NeoJSONObject fromString: (self cacheAt: #json ifAbsent: '{}') ] - ifNil: [ "how to iterate until root?" - NeoJSONObject fromString: (self cacheAt: #json ifAbsent: '{}') ] -] - { #category : #accessing } FamixValueOfType >> attributeInObjects [ "Relation named: #attributeInObjects type: #FamixValueOfObjectAttribute opposite: #value" diff --git a/src/Famix-Value-Exporter/FamixValue2FASTJavaVisitor.class.st b/src/Famix-Value-Exporter/FamixValue2FASTJavaVisitor.class.st index d9f7350..fd7c6d6 100644 --- a/src/Famix-Value-Exporter/FamixValue2FASTJavaVisitor.class.st +++ b/src/Famix-Value-Exporter/FamixValue2FASTJavaVisitor.class.st @@ -186,49 +186,7 @@ FamixValue2FASTJavaVisitor >> makeHelperClass [ expression: (model newNewExpression type: (model newClassTypeExpression typeName: - (model newTypeName name: 'ObjectMapper')))) }). - (model newMethodEntity - typeParameters: - { (model newTypeParameterExpression name: 'T') }; - type: - (model newClassTypeExpression typeName: - (model newTypeName name: 'T')); - name: 'deserialize'; - parameters: { - (model newParameter - variable: (model newVariableExpression name: 'json'); - type: (model newClassTypeExpression typeName: - (model newTypeName name: 'String'))). - (model newParameter - variable: (model newVariableExpression name: 'clazz'); - type: (model newClassTypeExpression - typeName: (model newTypeName name: 'Class'); - arguments: { (model newClassTypeExpression typeName: - (model newTypeName name: 'T')) })) }; - modifiers: { - (model newModifier token: 'public'). - (model newModifier token: 'static') }; - statementBlock: (model newStatementBlock statements: { - (model newTryCatchStatement - try: (model newStatementBlock statements: - { (model newReturnStatement expression: - (model newMethodInvocation - receiver: (model newIdentifier name: 'mapper'); - name: 'readValue'; - arguments: { - (model newVariableExpression name: 'json'). - (model newVariableExpression name: 'clazz') })) }); - catches: { (model newCatchPartStatement - catchedTypes: - { (model newClassTypeExpression typeName: - (model newTypeName name: 'IOException')) }; - body: (model newStatementBlock statements: - { (model newExpressionStatement expression: - (model newMethodInvocation - receiver: (model newIdentifier name: 'e'); - name: 'printStackTrace')) }); - parameter: (model newVariableExpression name: 'e')) }). - (model newReturnStatement expression: model newNullLiteral) })) } + (model newTypeName name: 'ObjectMapper')))) }) } ] { #category : #ast } @@ -450,20 +408,9 @@ FamixValue2FASTJavaVisitor >> visitObjectOfRegularType: object [ { #category : #visiting } FamixValue2FASTJavaVisitor >> visitObjectStub: object [ + "Previously tried to recreate stubs by deserializing their JSON representation, but getting a correct JSON string is a challenge." - self statementBlock addStatement: (self model newVarDeclStatement - type: (object asFASTJavaTypeExpressionOn: self); - addDeclarator: (self model newVariableDeclarator - variable: (self makeVariableExpression: object); - expression: (model newMethodInvocation - name: 'deserialize'; - arguments: { - (model newStringLiteral primitiveValue: - object asJsonString). - (model newClassProperty - type: (object asFASTJavaTypeExpressionOn: self); - fieldName: 'class') })); - yourself) + self shouldBeImplemented ] { #category : #visiting }