In some cases it might happen that there is no description provided to use with a class. If your domain manipulates money (amount and currency) or URLs (scheme, domain, port, path, parameters) you may want to define your own descriptions (or load an extension package that already provides these descriptions) to take advantage of Magritte.
Extending Magritte is simple, create your own description but remember that Magritte is described within itself so you have to provide certain information.
- Create a subclass of
- On the class-side override:
isAbstractto return false,
labelto return the name of the description. On the instance-side override:
kindto return the base-class,
acceptMagritte:to enable visiting and
- Create a view, if you want to use it for UI building.
We suggest you have a look at existing descriptions. In addition, carefully choosing the right superclass can already provide you part of what you are looking for. Parsing, printing and (de)serialization is implemented by the following visitors: