-
Notifications
You must be signed in to change notification settings - Fork 34
Cookbook
add
self new asMagritteMorph
addButtons;
addWindow;
onAnswer: [ :newProject | self projects add: newProject ];
openInWorld
anObject readUsing: aDescription
is implemented on both Object and Memento classes, so it will work in tricky situations where you may have either (e.g. container validation)
Subclass MAAdaptiveModel. The original Magritte paper mentioned (on page 10) turning it into a Trait so it could be applied to any class
Let's say you have a description that you'd like to extend, but it's in a package that you can't modify. Just use the magritteDescription:
annotation. For example:
MARelationDescription>>#descriptionClassesWithMorphic: description
<magritteDescription: #descriptionClasses>
^ description
morphClass: MATokenCompletionMorph;
yourself
INSERT DESCRIPTION HERE
Object>>#printMagritteOn: concatenates child descriptions into a print string and can easily be used like:
MyDescribedObject>>#printOn: aStream
self printMagritteOn: aStream
Return the current value of a field, or the default specified in the description
MyDomainObject>>#getter
^ self maLazyFromDescriptionOf: #getter
where:
MyDomainObject>>#getterDescription
^ MAElementDescription new
accessor: #getter;
default: 1;
yourself
The TMagritteBootstrap
trait in the Magritte-Bootstrap
package uses the magic of DNU to handle unimplemented messages via descriptions. In other words, an unknown #phoneNumber message would return a phone number if there was a child description with a #phoneNumber selector or instVar accessor.