@Show and it will be visible in the playground!
For example, check out the code for Average Stock Price, and you will see that
we have decorated averagePrice with @Show. That’s why it shows up here:
You can decorate as many data members you want, event private ones!
Customizing how the data is presented
Say if you have a class which you are using to model a database. It has a member calleddata, which you’d want to decorate with @Show.
data could actually be rendered as a table?
Table View
Well, yes! That’s why we have@Table, which you can decorate your class with. Simply provide the “columns” you want to show and you get a nice looking view!
For example:
- Code
- View
With table view, only one member should be decorated with
@Show and it should be an array of records.Collection View
Similarly, we have@Collection to show objects.
For example:
- Code
- View
With collection view, only one member should be decorated with
@Show and it should be an array of records.KeyValue View
And lastly, you can use@KeyValue to render a Map.
For example:
- Code
- View
With keyvalue view, only one member should be decorated with
@Show and it should be a Map.Where did all the methods go?
When you assign a view to a class, the runtime collapses its corresponding node. All the methods are hidden, and all the edges going to those methods now go to the parent class node. Giving the view a clean look. Mind you, simply decorating a member with@Show won’t cause this. You have to assign a view to the class.