On Wed, May 30, 2012 at 6:50 PM, Mariano Martinez Peck <marianopeck@gmail.com> wrote:
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?
 

Well I noticed that all objects found in descriptionOf:  are MooseEntities. So this is cool. The only missing part is that if ALL MooseEntities should be serialized with this special way (our extension) intead of the normal one, or only those which are present in MooseModel descriptionOf ...
so do you know?

In either case, we can simplify our extension quite a lot.


 
I ask because it would make the code much easier.

thanks

--
Mariano
http://marianopeck.wordpress.com




--
Mariano
http://marianopeck.wordpress.com