Skip to content

Commit

Permalink
Exporter: Rename strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel-Darbord committed Apr 19, 2024
1 parent 17526ce commit 25cc359
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ FamixValue2FASTJavaVisitor >> model [
FamixValue2FASTJavaVisitor >> objectExportStrategy [

^ objectExportStrategy ifNil: [
objectExportStrategy := FamixValueObjectInlineExportStrategy new ]
objectExportStrategy := FamixValueInlineObjectExportStrategy new ]
]

{ #category : #accessing }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Class {
#name : #FamixValueAbstractObjectExportStrategy,
#superclass : #Object,
#category : #'Famix-Value-Exporter-Strategies'
}

{ #category : #testing }
FamixValueAbstractObjectExportStrategy class >> isAbstract [

^ self == FamixValueAbstractObjectExportStrategy
]

{ #category : #ast }
FamixValueAbstractObjectExportStrategy >> addToHelper: helperClass [
"Hook to add strategy specifics to the helper class. By default, do nothing."
]

{ #category : #ast }
FamixValueAbstractObjectExportStrategy >> dependencyImportsOn: aFASTModel [

^ { }
]

{ #category : #exporting }
FamixValueAbstractObjectExportStrategy >> export: object on: visitor [

self subclassResponsibility
]
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
Class {
#name : #FamixValueObjectHelperExportStrategy,
#superclass : #FamixValueObjectExportStrategy,
#name : #FamixValueHelperObjectExportStrategy,
#superclass : #FamixValueAbstractObjectExportStrategy,
#instVars : [
'helperMethods'
],
#category : #'Famix-Value-Exporter-Strategies'
}

{ #category : #ast }
FamixValueObjectHelperExportStrategy >> addToHelper: helperClass [
FamixValueHelperObjectExportStrategy >> addToHelper: helperClass [
"Must be called when building the helper class to add the generated helper methods."

helperMethods valuesDo: [ :method |
helperClass addDeclaration: method ]
]

{ #category : #ast }
FamixValueObjectHelperExportStrategy >> buildMethodFor: object withParametersFor: attributes on: visitor [
FamixValueHelperObjectExportStrategy >> buildMethodFor: object withParametersFor: attributes on: visitor [
"Build the helper method to construct objects of the same type as the one given in argument.
Use only the relevant attributes that are given, rather than all attributes."

Expand All @@ -43,7 +43,7 @@ FamixValueObjectHelperExportStrategy >> buildMethodFor: object withParametersFor
]

{ #category : #ast }
FamixValueObjectHelperExportStrategy >> dependencyImportsOn: aFASTModel [
FamixValueHelperObjectExportStrategy >> dependencyImportsOn: aFASTModel [

^ { ((aFASTModel newImportDeclaration qualifiedName:
(aFASTModel newQualifiedName name:
Expand All @@ -53,7 +53,7 @@ FamixValueObjectHelperExportStrategy >> dependencyImportsOn: aFASTModel [
]

{ #category : #exporting }
FamixValueObjectHelperExportStrategy >> export: object on: visitor [
FamixValueHelperObjectExportStrategy >> export: object on: visitor [
"Use a helper method to instantiate the object and set its attributes."

| attributes helper model |
Expand Down Expand Up @@ -84,13 +84,13 @@ FamixValueObjectHelperExportStrategy >> export: object on: visitor [
]

{ #category : #initialization }
FamixValueObjectHelperExportStrategy >> initialize [
FamixValueHelperObjectExportStrategy >> initialize [

helperMethods := IdentityDictionary new
]

{ #category : #ast }
FamixValueObjectHelperExportStrategy >> makeMethodFor: aFamixType withParametersFor: attributes on: visitor [
FamixValueHelperObjectExportStrategy >> makeMethodFor: aFamixType withParametersFor: attributes on: visitor [
"Make the method entity, handles its signature and modifiers."

| model |
Expand All @@ -116,7 +116,7 @@ FamixValueObjectHelperExportStrategy >> makeMethodFor: aFamixType withParameters
]

{ #category : #ast }
FamixValueObjectHelperExportStrategy >> makeSetterInvocationsFor: attributes on: visitor [
FamixValueHelperObjectExportStrategy >> makeSetterInvocationsFor: attributes on: visitor [
"Build the helper method's body: set the value of each argument to the corresponding attribute using setters or reflection."

attributes do: [ :attribute |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Class {
#name : #FamixValueObjectInlineExportStrategy,
#superclass : #FamixValueObjectExportStrategy,
#name : #FamixValueInlineObjectExportStrategy,
#superclass : #FamixValueAbstractObjectExportStrategy,
#category : #'Famix-Value-Exporter-Strategies'
}

{ #category : #exporting }
FamixValueObjectInlineExportStrategy >> export: object on: visitor [
FamixValueInlineObjectExportStrategy >> export: object on: visitor [

self flag: #TODO. "redo object visit, we need to have attributes ready when calling the constructor.
We need to know if an attribute has been set using the constructor or if it will be set using a setter!"
Expand Down
28 changes: 0 additions & 28 deletions src/Famix-Value-Exporter/FamixValueObjectExportStrategy.class.st

This file was deleted.

0 comments on commit 25cc359

Please sign in to comment.