Skip to content

Commit

Permalink
Merge pull request #676 from moosetechnology/674-FamixMetamodel-docum…
Browse files Browse the repository at this point in the history
…entor-do-not-print-Object-properties

674 famix metamodel documentor do not print object properties
  • Loading branch information
NicolasAnquetil authored Jan 8, 2024
2 parents e019439 + 1004f10 commit 8daf1f3
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 10 deletions.
18 changes: 11 additions & 7 deletions src/Famix-UMLDocumentor-Tests/FamixUMLDocumentorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ FamixUMLDocumentorTest >> testGenerateEntireModel [
{ #category : #'tests - generation' }
FamixUMLDocumentorTest >> testGeneratePropertyOf [

| fmClass umlEntity |
| fmClass umlClass umlProp |

documentor
model: FDModel ;
Expand All @@ -150,15 +150,19 @@ FamixUMLDocumentorTest >> testGeneratePropertyOf [
documentor generateClass: fmClass.

self assert: documentor umlEntities size equals: 1.
umlEntity := documentor umlEntities anyOne.
umlClass := documentor umlEntities anyOne.

documentor generateProperties: fmClass uml: umlClass.

documentor generateProperties: fmClass uml: umlEntity.
self assert: umlClass properties size equals: 2.

self assert: umlEntity properties size equals: 1.
umlProp := umlClass properties detect: [:p | p name = 'someProp' ] ifNone: [ nil ].
self assert: umlProp isNotNil.
self assert: umlProp type equals: 'String'.

umlEntity := umlEntity properties anyOne.
self assert: umlEntity name equals: 'someProp'.
self assert: umlEntity type equals: 'String'.
umlProp := umlClass properties detect: [:p | p name = 'otherProp' ] ifNone: [ nil ].
self assert: umlProp isNotNil.
self assert: umlProp type equals: 'Object'.

]

Expand Down
5 changes: 4 additions & 1 deletion src/Famix-UMLDocumentor-Tests/FamixUMLTestGenerator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ FamixUMLTestGenerator >> defineProperties [
super defineProperties.

(t4 property: #someProp type: #String)
comment: 'A property in the trait'
comment: 'A property in the trait'.

(t4 property: #otherProp type: #Object)
comment: 'Another property in the trait'.
]

{ #category : #definition }
Expand Down
7 changes: 5 additions & 2 deletions src/Famix-UMLDocumentor/FamixUMLDocumentor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,12 @@ FamixUMLDocumentor >> generateInheritance: fmClass uml: umlClass [

{ #category : #generating }
FamixUMLDocumentor >> generateProperties: aFMClass uml: umlClass [
"accept FM3Object as a primitive type (#isRoot = true)"

aFMClass primitiveProperties do: [ :prop |
umlClass addProperty: (FamixUMLProperty from: prop) ].
aFMClass properties do: [ :prop |
(prop type isPrimitive or: [ prop type isRoot ])
ifTrue: [umlClass addProperty: (FamixUMLProperty from: prop) ]
]

]

Expand Down
3 changes: 3 additions & 0 deletions src/Famix-UMLDocumentor/FamixUMLRoassalDescriptor.class.st
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
"
The Roassal part of the Roassal backend exporter
"
Class {
#name : #FamixUMLRoassalDescriptor,
#superclass : #RSUMLClassDescriptor,
Expand Down
16 changes: 16 additions & 0 deletions src/FamixDocumentor-TestMetaModel/FDTrait4.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Trait {
#name : #FDTrait4,
#instVars : [
'#class1 => FMMany type: #FDClass1 opposite: #myTrait',
'#otherProp => FMProperty',
'#someProp => FMProperty'
],
#traits : 'FDTrait2',
Expand Down Expand Up @@ -40,6 +41,21 @@ FDTrait4 >> class1: anObject [
class1 value: anObject
]

{ #category : #accessing }
FDTrait4 >> otherProp [

<FMProperty: #otherProp type: #Object>
<generated>
<FMComment: 'Another property in the trait'>
^ otherProp
]

{ #category : #accessing }
FDTrait4 >> otherProp: anObject [
<generated>
otherProp := anObject
]

{ #category : #accessing }
FDTrait4 >> someProp [

Expand Down

0 comments on commit 8daf1f3

Please sign in to comment.