Skip to content

Instantly share code, notes, and snippets.

@develar
Created September 1, 2010 19:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save develar/561182 to your computer and use it in GitHub Desktop.
Save develar/561182 to your computer and use it in GitHub Desktop.
Compact YAML syntax
-------------------
Although the base YAML format is already pretty concise, JavaBuilders adds a custom extension to it
that we call "virtual constructor flow", otherwise referred to simply as compact YAML. It allows to specify
the child properties of an object in the same line of text as the object definition.
Here's a pure YAML example::
JFrame:
name: frame
title: My Frame
content:
- JButton:
name: buttonClose
text: Close
onAction: close
- JButton:
name: buttonSave
text: Save
onAction: save
The same content can be entered in much less lines using our compact syntax::
JFrame(name=frame,title=My Frame):
- JButton(name=buttonClose,text=Close,onAction=close)
- JButton(name=buttonSave,text=Save,onAction=save)
Let's be clear: this is not part of the official YAML standard. This is something specific to JavaBuilders
that was added to make the YAML file even smaller.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment