Hi guys. Right now, our extension to export Moose models does the
following:
accepts: anObject
MooseModel meta
descriptionOf: anObject class
ifAbsent: [ ^ false ].
^ true
so....if an object is NOT found in the #descriptionOf: then we use the
normal Fuel serialization. If it WAS found, then we do something like:
FLFameCluster >> referencesOf: anObject do: aBlock
self attributes
do: [ :anAttribute |
| values |
values := anAttribute getFrom: anObject.
(self shouldIgnore: anAttribute withAll: values)
ifTrue: [ aBlock value: 0 ]
ifFalse: [
aBlock value: values size.
values do: [ :aValue | aBlock value: aValue ] ] ]
and
shouldIgnore: attribute withAll: values
"Copied from FMRepositoryVisitor>>ignoreProperty:withAll:"
^ values isEmpty or: [
attribute isDerived or: [
attribute type == FM3MetaDescription boolean and: [
values size == 1 and: [
values first == false ]]]]
so...basically we follow all attributes.
Now...my question is (actually, Martin), instead of doing the "if" to see
whether I should do that or the normal fuel procedure, instead of being
MooseModel meta descriptionOf: anObject class ifAbsent:
can be: "object kindOf: MooseEntity" ?
would that be the same? in other words, all what is included in
descriptionOf: are MooseEntities? all MooseEntities (whether they are
included in descriptionOf: or not should be ne serialized that way?
I ask because it would make the code much easier.
thanks
--
Mariano
http://marianopeck.wordpress.com